MySQL Syntax Error - Not Saving
#1

So I had this working, I played around and tried adding Health and Armour, didn't work out and tried to reverse everything but now the code isn't working to save. Was wondering if anyone here can point out what this error could be from?

Error Code:
Код:
[08:13:55] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET `Money` = '%d' , `PosX` = '%f' , `PosY` = '%f' , `PosZ` = '%f' , `PosA` = '%f' WHERE `ID` = '%d'"
[08:13:55] [ERROR] mysql_format - destination size is too small
[08:13:55] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `Money` = '0' , `PosX` = '1706.716' , `Pos", callback: "(null)", format: "(null)"
[08:13:55] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[08:13:56] [ERROR] CMySQLQuery::Execute[] - (error #1064) 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 '' at line 1
[08:13:56] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
Code:
OnPlayerDisconnect:
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[128], Float:pos[4]; 
         
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]); 
    GetPlayerFacingAngle(playerid, pos[3]); 
     
    mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET `Money` = '%d' , `PosX` = '%f' , `PosY` = '%f' , `PosZ` = '%f' , `PosA` = '%f' WHERE `ID` = '%d'",
    GetPlayerMoney(playerid), pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]); 
    mysql_tquery(mysql, query, "", ""); 
     
    return true; 
}
I would assume it would be in the playerdisconnect as everything will load when joining, but nothing saves when leaving. If it isn't this, I'll post the other areas with MySQL.
Reply
#2

"destination size is too small" =.=

change query[128] to query[256] and try again
Reply
#3

Quote:
Originally Posted by rickisme
Посмотреть сообщение
"destination size is too small" =.=

change query[128] to query[256] and try again
God damn, I didn't think it was that, because I had it working already before, I thought I just had a weird syntax or I was missing like an apostrophe or something.

Thanks a lot for that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)