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=663039)



mysql error - rockys - 19.01.2019

HTML Code:
new query[400];
mysql_format(SQL,query,500,"INSERT INTO `factions_chat` (`text`,`playerid`,`factionid`) VALUES ('%s','%d','%d')",string,PlayerInfo[playerid][pSQLID],PlayerInfo[playerid][pMember]);
mysql_tquery(SQL,query,"","");



error:
(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 'ca eu atunci am iesit','1200','8')' at line 1 (Query: "INSERT INTO `factions_chat` (`text`,`playerid`,`factionid`) VALUES ('(Faction Las Venturas Police Department) ()x(): numa' ca eu atunci am iesit','1200','8')")



Re: mysql error - StRaphael - 20.01.2019

Use %e instead of %s. It escapes the ' sign.