MySQL quits creating new rows when a new player register, what's the reason?
I started a new blank page of pawn to detect what is causing the problem and i didn't figure it out!
Here is the script of registering dialog:
PHP код:
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
new day,month,year,ip[16],date[11]; GetPlayerIp(playerid, ip, sizeof(ip)); getdate(year,month,day);
format(date, sizeof(date), "%i/%i/%i", day, month, year);
mysql_format(ConnectionHandle, query, sizeof(query), "INSERT INTO accounts (username, password, registerdate, ip) VALUES ('%s','%s','%s','%s')", GetName(playerid), inputtext, date, ip);
mysql_format(ConnectionHandle, query, sizeof(query), "SELECT * FROM accounts WHERE username = '%s' LIMIT 1", GetName(playerid));
mysql_tquery(ConnectionHandle, query, "LoadUserData", "i", playerid);
format(string, sizeof(string), "{FFFFFF}Account Has Been Registered Successflly\n\n{E8E654}Account: {FFFFFF}%s\n\nType Your Password Below To Login.", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{F03A3A}Juvanii's Cops And Robbers",string,"Login","Quit");
return 1;
}
LoadUserData Callback:
PHP код:
forward LoadUserData(playerid);
public LoadUserData(playerid)
{
new rows, fields;
cache_get_data(rows, fields, ConnectionHandle);
printf("rows: %d | fields: %d", rows, fields);
if(rows)
{
cache_get_field_content(0, "password", PlayerInfo[playerid][Password], ConnectionHandle, 64);
cache_get_field_content(0, "registerdate", PlayerInfo[playerid][RegisterDate], ConnectionHandle, 11);
cache_get_field_content(0, "ip", PlayerInfo[playerid][IP], ConnectionHandle, 16);
PlayerInfo[playerid][Money] = cache_get_field_content_int(0, "money");
PlayerInfo[playerid][Score] = cache_get_field_content_int(0, "score");
PlayerInfo[playerid][Warrents] = cache_get_field_content_int(0, "warrents");
PlayerInfo[playerid][RegularPlayer] = cache_get_field_content_int(0, "regularplayer");
}
return 1;
}
debug returns 0 rows and 8 fields, it's okay for the fields but why 0 rows ?
MySQL Log when a player join:
Код:
[01:34:34] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM `accounts` WHERE `username` = '%e' LIMIT 1"
[01:34:34] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `accounts` WHERE `username` = 'Juvanii' LIMIT 1", callback: "AccountChecking", format: "i"
[01:34:34] [DEBUG] CMySQLQuery::Execute[AccountChecking] - starting query execution
[01:34:34] [DEBUG] CMySQLQuery::Execute[AccountChecking] - query was successfully executed within 0.964 milliseconds
[01:34:34] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[01:34:34] [DEBUG] Calling callback "AccountChecking"..
[01:34:34] [DEBUG] cache_get_data - connection: 1
[01:34:34] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
MySQL Log when a player register:
Код:
[01:34:55] [DEBUG] mysql_format - connection: 1, len: 128, format: "INSERT INTO accounts (username, password, registerdate, ip) VALUES ('%s','%s','%s','%s')"
[01:34:55] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM accounts WHERE username = '%s' LIMIT 1"
[01:34:55] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM accounts WHERE username = 'Juvanii' LIMIT 1", callback: "LoadUserData", format: "i"
[01:34:55] [DEBUG] CMySQLQuery::Execute[LoadUserData] - starting query execution
[01:34:55] [DEBUG] CMySQLQuery::Execute[LoadUserData] - query was successfully executed within 0.340 milliseconds
[01:34:55] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[01:34:55] [DEBUG] Calling callback "LoadUserData"..
[01:34:55] [DEBUG] cache_get_data - connection: 1
[01:34:55] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Any help ?