SA-MP Forums Archive
little mysql UPDATE query help - 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: little mysql UPDATE query help (/showthread.php?tid=547970)



little mysql UPDATE query help - PawnoQ - 26.11.2014

hi,

i just cant figure out why this query is not working:

pawn Код:
Current_Map_Name="Jefferson";
Current_Map_Mode="TDM";

new querymap[64];
format(querymap, sizeof(querymap), "UPDATE list SET map='%s [%s]', player='0'",Current_Map_Name,Current_Map_Mode);
mysql_query(querymap);
Before i added the [%s] part it was working just fine, now it tells me wrong mysql syntax.


thanks.


Re: little mysql UPDATE query help - Capua - 26.11.2014

pawn Код:
format(querymap, sizeof(querymap), "UPDATE list SET map='%s', '%s', player='0'",Current_Map_Name,Current_Map_Mode);



Re: little mysql UPDATE query help - PawnoQ - 26.11.2014

not working.
Also i would like to have the brackets in the query...


Re: little mysql UPDATE query help - Jonesy96 - 26.11.2014

EDIT - Nevermind


Re: little mysql UPDATE query help - Misiur - 26.11.2014

Could you paste here your syntax error message?


Re: little mysql UPDATE query help - PawnoQ - 26.11.2014

just this: [MySQL] Error (0): Failed to exeute query. 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.


Re: little mysql UPDATE query help - Capua - 26.11.2014

pawn Код:
Current_Map_Name="Jefferson";
Current_Map_Mode="TDM";
new mapstring[100];
format(mapstring, sizeof(mapstring), "%s [%s]",Current_Map_Name,Current_Map_Mode);
new querymap[64];
format(querymap, sizeof(querymap), "UPDATE `list` SET map = '%s', player = '0'", mapstring);
mysql_query(querymap);
Now?


Re: little mysql UPDATE query help - Runn3R - 26.11.2014

pawn Код:
format(querymap, sizeof(querymap), "UPDATE `list` SET `map`='%s', player='0'",Current_Map_Name);
Try now.

EDIT: TOO LATE.


Re: little mysql UPDATE query help - AnthonyTimmers - 26.11.2014

put print(querymap) in, and please tell me what is written in the console so I can see what's wrong.