SA-MP Forums Archive
mySQL problem - 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 problem (/showthread.php?tid=283852)



mySQL problem - austin070 - 17.09.2011

EDIT: FIXED

I can't get mySQL to save player position. Here is my code:
pawn Код:
SavePlayerData(playerid)
{
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
   
    new query[600];
    format(query, 600, "UPDATE accounts SET LastX = '%f', LastY = '%f', LastZ = '%f', LastA = '%f' WHERE ID = '%d'", x, y, z, a, PlayerInfo[playerid][ID]);
    mysql_query(query);
    return 1;
}
Note: Please don't make a comment on my signature. I've already used ****** -.-


Re: mySQL problem - Retardedwolf - 17.09.2011

pawn Код:
UPDATE accounts SET ( LastX, LastY, LastZ, LastA ) WHERE ID = '%d' VALUES( '%f', '%f', '%f', '%f' )
Try that query.


Re: mySQL problem - =WoR=G4M3Ov3r - 17.09.2011

I don't know what you mean exactly, but if its not saving in the .sql database, try using this

PHP код:
ConnectToDatabase(); 



Re: mySQL problem - austin070 - 17.09.2011

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
pawn Код:
UPDATE accounts SET ( LastX, LastY, LastZ, LastA ) WHERE ID = '%d' VALUES( '%f', '%f', '%f', '%f' )
Try that query.
I fixed it right before you posted. I changed
pawn Код:
WHERE ID = '%d'
to
pawn Код:
WHERE Name = '%s'
Thank you for the response, anyway.


Re: mySQL problem - Retardedwolf - 17.09.2011

Using the mysql_debug function could also help a lot.


Re: mySQL problem - [HiC]TheKiller - 17.09.2011

pawn Код:
mysql_debug(1);
On OnGameModeInit then go to the MySQL log in the server directory and paste it here.