Mysql update query - 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 update query (
/showthread.php?tid=606343)
Mysql update query -
ScIrUsna - 03.05.2016
Hi,
Can i update query without ' ?
Код:
update table set smthing=%s where name=%s ?
Re: Mysql update query -
introzen - 03.05.2016
Why would you?
Re: Mysql update query -
ScIrUsna - 03.05.2016
Because i'am getting syntax errors of using ' because '%s' and if text is with ' 'hello'myname' i get syntax
Re: Mysql update query -
kaisersouse - 03.05.2016
Then you need to figure out a way to strip or replace the use of ' within chat/text/strings
Basically you need to convert the ' being used to " or \' (i believe), BEFORE its fed into the mysql query
Re: Mysql update query -
Konstantinos - 03.05.2016
Not using ' ' to make it a text will result in more problems as it will find those words invalid keywords.
You'll need to escape the strings so use mysql_format with '%e' specifier.
Re: Mysql update query -
ScIrUsna - 03.05.2016
Can i use mysql_real_escape_string instead?
And i notice if i use mysql_format with %e specifier inquiries carried out and i self test if ' is escaped to \' i tried in phpmyadmin make query where text was with \' and query was not updated