MySQL Error - 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 (
/showthread.php?tid=607287)
MySQL UPDATE not working -
dragondex - 17.05.2016
Hello everyone,
When i save my account it doesn't update the MySQL table.
MySQL Log:
Код:
[15:33:23] [DEBUG] mysql_format - connection: 1, len: 1024, format: "UPDATE `accounts` SET `Money` = '%d', `Admin` = '%d', `PosX` = '%f', `PosY` = '%f', `PosZ` = '%f', `PosA` = '%f' WHERE `ID` = '%..."
[15:33:23] [DEBUG] mysql_format - connection: 1, len: 1024, format: "UPDATE `accounts` SET `Frozen` = '%d', `PlayerJailed` = '%d', `PlayerJailedTimer` = '%d', `PoliceStatsFined` = '%d' WHERE `ID` =..."
[15:33:23] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `Money` = '20000', `Admin` = '3', `PosX` =", callback: "(null)", format: "(null)"
[15:33:23] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `Frozen` = '1', `PlayerJailed` = '1', `Pla", callback: "(null)", format: "(null)"
[15:33:23] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[15:33:23] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 52.890 milliseconds
[15:33:23] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[15:33:23] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[15:33:23] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.275 milliseconds
[15:33:23] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
After the PosX and 'Pla' there are more things that needs to be saved but it only says callback: null
PAWNO:
Код:
public OnAccountSave()
{
foreach(new i:Player)
{
if(PlayerInfo[i][LoggedIn] == 1)
{
new
query[1024],
query2[1024],
Float:pos[4];
GetPlayerPos(i, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(i, pos[3]);
mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET `Money` = '%d', `Admin` = '%d', `PosX` = '%f', `PosY` = '%f', `PosZ` = '%f', `PosA` = '%f' WHERE `ID` = '%d'",
GetPlayerCash(i),
PlayerInfo[i][Admin],
pos[0],
pos[1],
pos[2],
pos[3],
PlayerInfo[i][ID]);
mysql_format(mysql, query2, sizeof(query2), "UPDATE `accounts` SET `Frozen` = '%d', `PlayerJailed` = '%d', `PlayerJailedTimer` = '%d', `PoliceStatsFined` = '%d' WHERE `ID` = '%d'",
PlayerInfo[i][Frozen],
PlayerInfo[i][PlayerJob],
PlayerInfo[i][PlayerJailed],
PlayerInfo[i][PlayerJailedTimer],
PlayerInfo[i][PoliceStatsFined],
PlayerInfo[i][ID]);
mysql_tquery(mysql, query, "", "");
mysql_tquery(mysql, query2, "", "");
SendClientMessage(i, COLOR_RED, "Stats saved");
}
}
return 1;
}
Could anyone tell me what im doing wrong?
Thanks in advance