refiking Posted November 23, 2008 Share Posted November 23, 2008 Here's the error message: 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 jewelrty rocks here it is again!fff )')' at line 1 Here's the code: $sql = mysql_query("SELECT * FROM `textads` WHERE `text_ad_id` = '$text_ad_id'")or die(mysql_error()); while ($row = mysql_fetch_assoc($sql)){ $text_ad = stripslashes($row['text_ad']); $type = $row['type']; } mysql_query("INSERT INTO `textads_backup` (`type`, `text_ad`) VALUES ('$type', '$text_ad')")or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/133943-solved-sql-syntax-problem-w-apostrophe/ Share on other sites More sharing options...
wildteen88 Posted November 23, 2008 Share Posted November 23, 2008 $text_ad = stripslashes($row['text_ad']); should be $text_ad = mysql_real_escape_string($row['text_ad']); Quote Link to comment https://forums.phpfreaks.com/topic/133943-solved-sql-syntax-problem-w-apostrophe/#findComment-697249 Share on other sites More sharing options...
Adam Posted November 23, 2008 Share Posted November 23, 2008 $text_ad = stripslashes($row['text_ad']); You need slashes to escape the quotes, try removing the "stripslashes()" function.. or use "addslashes()" in the query .. Adam Quote Link to comment https://forums.phpfreaks.com/topic/133943-solved-sql-syntax-problem-w-apostrophe/#findComment-697252 Share on other sites More sharing options...
wildteen88 Posted November 23, 2008 Share Posted November 23, 2008 $text_ad = stripslashes($row['text_ad']); You need slashes to escape the quotes, try removing the "stripslashes()" function.. or use "addslashes()" in the query .. Adam No, better to use mysql_real_escape_string in this situation. Quote Link to comment https://forums.phpfreaks.com/topic/133943-solved-sql-syntax-problem-w-apostrophe/#findComment-697254 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.