ted_chou12 Posted December 27, 2006 Share Posted December 27, 2006 I cant store single quotation marks in mysql database, it comes up this: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 'aaaaaaaaaaaaaaaaa', favourite='aaaaaaaaaaaaaaaaaaaaaaaaaa', wish='aaaaaaaaa', si' at line 1which is really annoy, how do you make it store single quotation marks " ' <<<this thing " please?Thanks Ted Link to comment https://forums.phpfreaks.com/topic/31976-single-quotation-mark-and-mysql/ Share on other sites More sharing options...
Orio Posted December 27, 2006 Share Posted December 27, 2006 Escape it- instead of a single quote, write \'.Orio. Link to comment https://forums.phpfreaks.com/topic/31976-single-quotation-mark-and-mysql/#findComment-148377 Share on other sites More sharing options...
kenrbnsn Posted December 27, 2006 Share Posted December 27, 2006 Or use the mysql_real_escape_string() function on the value.Ken Link to comment https://forums.phpfreaks.com/topic/31976-single-quotation-mark-and-mysql/#findComment-148389 Share on other sites More sharing options...
ted_chou12 Posted December 27, 2006 Author Share Posted December 27, 2006 thanks, by the way, i have one question, does mysql automatically remove the slashes? because i cant seem to see them in the admin databaseThanksTed Link to comment https://forums.phpfreaks.com/topic/31976-single-quotation-mark-and-mysql/#findComment-148401 Share on other sites More sharing options...
alpine Posted December 27, 2006 Share Posted December 27, 2006 yes Link to comment https://forums.phpfreaks.com/topic/31976-single-quotation-mark-and-mysql/#findComment-148406 Share on other sites More sharing options...
Hypnos Posted December 27, 2006 Share Posted December 27, 2006 The escape just tells it to insert it as a literal quote. The escape character won't be inserted.PHP is the same way too.[code=php:0]echo "This is to echo a \".";[/code]This is to echo a ". Link to comment https://forums.phpfreaks.com/topic/31976-single-quotation-mark-and-mysql/#findComment-148447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.