php str_replace for mysql question?

marks

New member
hello, When I try to insert the character ' in the mysql database via a php form it displays a error I could replace ' with ' but I don't want to
I want it to be submitted into the database as it is

the meta is set to utf8 and mysql set names too

Thank you,

Mark
I think I got it

mysql_real_escape_string()

could someone confirm this
 
wow that was a real fun problem for me a while back. The proper entry for single quotes (') in MySQL is to use the backslash(\) in front of it (so it looks like this \'. This is called escaping a character. You must use double quotes outside your string when using this method, so that the PHP will parse the backslash as an escaped character. When you return your quotes to HTML, you will need to unescape everything.
 
Back
Top