MySQL error 1064
#1

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
Reply
#2

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.
Reply
#3

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?
Reply
#4

Add data? INSERT
Update data? UPDATE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)