SA-MP Forums Archive
MySQL error 1064 - 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: MySQL error 1064 (/showthread.php?tid=427970)



MySQL error 1064 - Zalman - 04.04.2013

Code:
pawn Код:
CMD:move(playerid, params[]) {
    new szQuery[128], Location[128], Float:Pos1, Float:Pos2, Float:Pos3, Float:Angle;

    if(sscanf(params, "s[128]", Location))
        return SendClientMessage(playerid, COLOR_GREY, "SERVER: /Move [Location]");
    if(strcmp(Location, "Spawn", true) == 0)
    {
        GetPlayerPos(playerid, Pos1, Pos2, Pos3);
        GetPlayerFacingAngle(playerid, Angle);

        format(szQuery, sizeof(szQuery), "UPDATE configuration SET SpawnPosX = '%d', SpawnPosY = '%d', SpawnPosZ = '%d', SpawnPosAngle = '%d'", Pos1, Pos2, Pos3, Angle);
        mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
        SendClientMessage(playerid, COLOR_GREY, "Spawn location moved.");
    }
    else SendClientMessage(playerid, COLOR_GREY, "Invalid location.");
    return 1;
}
Error:
Код:
Error #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 ''1126695' at line 1 | Query: UPDATE configuration SET SpawnPosX = '1155937807', SpawnPosY = '1156348504', SpawnPosZ = '1093476352', SpawnPosAngle = '1126695



Re: MySQL error 1064 - LarzI - 04.04.2013

First of all: You're saving floats, not integers - you should use %f.
Second of all: Numeric values shouldn't be inside apostrophes ' ' - remove them.


Re: MySQL error 1064 - Zalman - 04.04.2013

Quote:
Originally Posted by LarzI
Посмотреть сообщение
First of all: You're saving floats, not integers - you should use %f.
Second of all: Numeric values shouldn't be inside apostrophes ' ' - remove them.
So how would I add data into my script when I have the table made? I don't think update is right is it?


Re: MySQL error 1064 - LarzI - 04.04.2013

Add data? INSERT
Update data? UPDATE