vwinstead Posted February 7, 2009 Share Posted February 7, 2009 I have found out how to properly get/put raw html code from the MySQL database. I can also display it properly in a browser. The only problem comes when I am trying to send it from the text editor to the database and it contains single quotes ('). Every other special character seems to work (&, "...etc), but when I try to put this single quote back into the database it spits back an error about my MySQL syntax having a problem. What do you have to do in order to put single quotes into the database that's different from all the other characters? Link to comment https://forums.phpfreaks.com/topic/144199-problem-with-quotes/ Share on other sites More sharing options...
ilikemath2002 Posted February 7, 2009 Share Posted February 7, 2009 Try "\'" Link to comment https://forums.phpfreaks.com/topic/144199-problem-with-quotes/#findComment-756718 Share on other sites More sharing options...
PFMaBiSmAd Posted February 7, 2009 Share Posted February 7, 2009 All string data put into a query that could contain special characters that have meaning in sql syntax, like ' or ", must be escaped. Use the mysql_real_escape_string function. This will also help prevent sql injection. Link to comment https://forums.phpfreaks.com/topic/144199-problem-with-quotes/#findComment-756721 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.