SA-MP Forums Archive
Help In MySQL - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help In MySQL (/showthread.php?tid=306880)



Help In MySQL - rati555 - 28.12.2011

Код:
errorid: 1064 | error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET `Kills` = '0' SET `Deaths` = '0' SET `Rank` = '75' WHERE `Name` = ''' at line 1 | resultid: -1 | extraid: -1 | callback: NULL | query: UPDATE `players` SET `Money` = '0' SET `Kills` = '0' SET `Deaths` = '0' SET `Rank` = '75' WHERE `Name` = ''
pawn Код:
//OnPlayerConnect
new
        Query[90];
    mysql_format(connection,Query,"SELECT `Name` FROM `players` WHERE `Name` = '%e'",GetPlayerNameEx(playerid));
    mysql_query(Query, USER_CHECK, playerid);
//----------------------------------------------------------------------------------//
stock SavePlayerVariables(playerid)
{
    new Query[200];
    format(Query,sizeof(Query),"UPDATE `players` SET `Money` = '%i' SET `Kills` = '%i' SET `Deaths` = '%i' SET `Rank` = '%i' WHERE `Name` = '%s'",GetPlayerMoney(playerid),pInfo[playerid][pKills],pInfo[playerid][pRank],GetPlayerEscapeName(playerid));
    mysql_query(Query);
}

stock LoadPlayerVariables(playerid)
{
    new
        query[200];

    mysql_format(connection,query,"SELECT * FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
    mysql_query(query, LOAD_ACCOUNT_DATA, playerid);
}
I get this error in console when player conects please help :S


Re: Help In MySQL - FireCat - 28.12.2011

pawn Код:
stock SavePlayerVariables(playerid)
{
    new Query[200];
    format(Query,sizeof(Query),"UPDATE `players` SET `Money` = '%i', `Kills` = '%i', `Deaths` = '%i', `Rank` = '%i' WHERE `Name` = '%s'",GetPlayerMoney(playerid),pInfo[playerid][pKills],pInfo[playerid][pRank],GetPlayerEscapeName(playerid));
    mysql_query(Query);
}



Re: Help In MySQL - WooTFTW - 28.12.2011

pawn Код:
stock SavePlayerVariables(playerid)
{
    new Query[200];
    format(Query,sizeof(Query),"UPDATE `players` SET `Money` = '%i', `Kills` = '%i',`Deaths` = '%i', `Rank` = '%i' WHERE `Name` = '%s'",GetPlayerMoney(playerid),pInfo[playerid][pKills],pInfo[playerid][pDeaths], pInfo[playerid][pRank],GetPlayerEscapeName(playerid));
    mysql_query(Query);
}
You forgot to input `Deaths` variable.