Problem with MySQL: ' - 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: Problem with MySQL: ' (
/showthread.php?tid=540762)
Problem with MySQL: ' -
Su37Erich - 07.10.2014
Hello,
I have a problem with the '. This problem appear when I create an area with a name like "Toreno's house."
So
[05:14:26] [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 's house', -750.710449, 899.665955, -635.393555, 995.825134, 100, 2, 3)' at line 1
Then mysql_format isn't working as I thought, so this could have vulnerabilities like a sql injection.
Anyone knows how can I fix this?
Note: I want use the ' anyway in my system.
Re: Problem with MySQL: ' -
Flake. - 07.10.2014
Show us the query..
Re: Problem with MySQL: ' -
Chenko - 07.10.2014
When you are using mysql_format instead of using "%s" for strings use "%e" so that it escapes it automatically. This should fix the error you are getting for having a ' character in the data.
Re: Problem with MySQL: ' -
Su37Erich - 10.10.2014
Thank you very much Chenko, it works!