Mysql problem.
#1

In debug log i have no errors but still the information is not stored in my DB.

pawn Код:
stock PlayerRegister(playerid, password[])
{
    new query[240];
    format(query,sizeof(query),"INSERT INTO `users` (name, pass) VALUES ('%s', '%s')",
        returnName(playerid),
        password
    );
    mysql_function_query(g_Handle,query,false,"OnPlayerRegister","i",playerid,password);
}
stock OnPlayerRegister(playerid,password[])
{
    PlayerInfo[playerid][pID] = mysql_insert_id();
    strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
    new loginstring[128];
    new loginname[64];
    GetPlayerName(playerid,loginname,sizeof(loginname));
    format(loginstring,sizeof(loginstring),"Welcome, %s\nYou can now login:",loginname);
    ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Exit");
}
pawn Код:
[20:59:05] Passing query INSERT INTO `users` (name, pass) VALUES ('jaw', 'test') | i
[20:59:05] ProcessQueryThread(OnPlayerRegister) - Query was successful. (INSERT INTO `users` (name, pass) VALUES ('jaw', 'test'))
[20:59:05] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
Reply
#2

What MySQL Version you use? R7?
Reply
#3

yes R7
Reply
#4

pawn Код:
stock PlayerRegister(playerid, password[])
{
    new query[240];
    format(query,sizeof(query),"INSERT INTO `users` (name, pass) VALUES ('%s', '%s')",
        returnName(playerid),
        password
    );
    mysql_function_query(g_Handle,query,false,"OnPlayerRegister","i",playerid,password);
}
You only put "i" on the function query, you need to add a string.

mysql_function_query(g_Handle,query,false,"OnPlaye rRegister","is",playerid,password);

(Not sure if this works, but there is no way of the password passing onto the OnPlayerRegister function.
Reply
#5

did it , but still does not work
pawn Код:
[21:39:51] Passing query INSERT INTO `users` (name, pass) VALUES ('jaw', 'test') | is
[21:39:51] ProcessQueryThread(OnPlayerRegister) - Query was successful. (INSERT INTO `users` (name, pass) VALUES ('jaw', 'test'))
[21:39:51] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
Reply
#6

Im not sure with this. as i never used MySQL R7 Atm. i only used R5 and R6.
give this a try

pawn Код:
stock PlayerRegister(playerid, password[])
{
    new query[240];
    format(query,sizeof(query),"INSERT INTO `users` (name,pass) VALUES (\'%s\',\'%s\')",returnName(playerid), password
    );
    mysql_function_query(g_Handle,query,false,"OnPlayerRegister","i",playerid);
}
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
    PlayerInfo[playerid][pID] = mysql_insert_id();
    ShowPlayerLogin(playerid);
    return 1;
}

stock ShowPlayerLogin(playerid, password[]);
{
    strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
    new loginstring[128];
    //
    new loginname[64];
    GetPlayerName(playerid,loginname,sizeof(loginname));
    format(loginstring,sizeof(loginstring),"Welcome, %s\nYou can now login:",loginname);
    ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Exit");
    return 1;
}
Reply
#7

Same thing , Query was successful. ... but when i check in phpmyadmin no account created ... i use Server2Go ...

pawn Код:
[21:54:23] Passing query INSERT INTO `users` (name,pass) VALUES ('jaw','test') | i
[21:54:23] ProcessQueryThread(OnPlayerRegister) - Query was successful. (INSERT INTO `users` (name,pass) VALUES ('jaw','test'))
[21:54:23] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
Reply
#8

Since the callback is called by name it must be PUBLIC. Not stock.
Reply
#9

Vince. oh yeah. thanks for the reminder! because you execute it it should be a public.

EDIT
Try my code again i edited it. Thanks to Vince to for remiding me shady001
Reply
#10

still don't work...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)