SA-MP Forums Archive
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=662627)



mysql error - rockys - 07.01.2019

how to fix this?
HTML Code:
(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 'Car Mod Shop' se afla la locatia [/gps - Los Santos - Car Mod Shop].')' at line 1 (Query: "INSERT INTO questions (`Sender`,`Question`,`Helper`,`Response`) VALUES ('1689','* Newbie xx: si unde este un car mod shop?','127','* Helper xx: @xx, Un 'Car Mod Shop' se afla la locatia [/gps - Los Santos - Car Mod Shop].')")
line:
HTML Code:
new var100[500];
mysql_format(SQL,var100, sizeof(var100), "INSERT INTO questions (`Sender`,`Question`,`Helper`,`Response`) VALUES ('%d','%s','%d','%s')", PlayerInfo[PlayerInfo[playerid][pNRE]][pSQLID],PlayerInfo[PlayerInfo[playerid][pNRE]][pNMessage],PlayerInfo[playerid][pSQLID], string);
mysql_tquery(SQL,var100,"","");



Re: mysql error - ch1ps - 07.01.2019

Debug it. Print all of the parameters with sendclientmessage or any other way you'd like to use, and see if everything looks good. If not, you could work out the solution from there.


Re: mysql error - Calisthenics - 07.01.2019

Escape the inputs. Replace '%s' with '%e'


Re: mysql error - Kraeror - 07.01.2019

Here you are:
PHP Code:
new var100[500];
mysql_format(SQL,var100sizeof(var100), "INSERT INTO `questions` (`Sender`,`Question`,`Helper`,`Response`) VALUES ('%d','%e','%d','%e')"PlayerInfo[PlayerInfo[playerid][pNRE]][pSQLID],PlayerInfo[PlayerInfo[playerid][pNRE]][pNMessage],PlayerInfo[playerid][pSQLID], string);
mysql_query(SQL,var100); 
Next time double check your syntax! And if you are not calling any callback in the query, just don't use the function mysql_tquery, just mysql_query!


Re: mysql error - rockys - 07.01.2019

ty :*