new query[1500];
mysql_real_escape_string(pInfo[playerid][Nick], pInfo[playerid][Nick]);
mysql_real_escape_string(pInfo[playerid][IP], pInfo[playerid][IP]);
format(query, sizeof(query), "INSERT INTO `playerdata` (`nick`, `password`, `ip`, `age`, `gender`, `skin`, `email`, `score`, `money`) VALUES('%s', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d')",
GetName(playerid),
udb_hash(inputtext),
pInfo[playerid][IP],
pInfo[playerid][Age],
pInfo[playerid][Gender],
pInfo[playerid][Skin],
pInfo[playerid][Email],
StarterLevel,
StarterMoney);
mysql_query(query);
}
E-MAIL must not be integer, as we can see; email contains string.So make it string.( '%d' to '%s')
EDIT: String..I mean; varchar, of course! Also, are you using this code when player disconnects? |
SavePlayer(playerid)
{
if(pInfo[playerid][Logged] == 1)
{
new Query[500];
format(Query, 500, "UPDATE `playerdata` SET `age` = %d, `gender` = %d, `skin` = %d, `country` = %d, `email` = %d, `admin` = %d, `helper` = %d, `moderator` = %d, `score` = %d, `money` = %d, `gold` = %d, `kills` = %d, `deaths` = %d, `experiencepoints` = %d, `experiencepointsneeded` = %d, `kicks` = %d, `bans` = %d, `banned` = %d, `playinghours`= %d, `secondslogged` = %d, `adminhelp` = %d WHERE `id` = %d",
pInfo[playerid][Age],
pInfo[playerid][Gender],
pInfo[playerid][Skin],
pInfo[playerid][Country],
pInfo[playerid][Email],
pInfo[playerid][pAdmin],
pInfo[playerid][pHelper],
pInfo[playerid][pMod],
pInfo[playerid][pScore],
pInfo[playerid][pMoney],
pInfo[playerid][Gold],
pInfo[playerid][pKills],
pInfo[playerid][pDeaths],
pInfo[playerid][ExperiencePoints],
pInfo[playerid][ExperiencePointsNeeded],
pInfo[playerid][kicks],
pInfo[playerid][bans],
pInfo[playerid][pBanned],
pInfo[playerid][PlayingHours],
pInfo[playerid][SecondsLoggedIn],
pInfo[playerid][AdminHelp],
pInfo[playerid][ID]);
mysql_query(Query);
}
}
format(Query, 500, "UPDATE `playerdata` SET `age` = %d, `gender` = %d, `skin` = %d, `country` = %d, `email` = '%s', `admin` = %d, `helper` = %d, `moderator` = %d, `score` = %d, `money` = %d, `gold` = %d, `kills` = %d, `deaths` = %d, `experiencepoints` = %d, `experiencepointsneeded` = %d, `kicks` = %d, `bans` = %d, `banned` = %d, `playinghours`= %d, `secondslogged` = %d, `adminhelp` = %d WHERE `id` = %d",
`email` = %d
`email` = '%s'