qwerty234 Posted April 30, 2007 Share Posted April 30, 2007 The variable $tools has an apostrophe ' in it. This kills the query. I have tried mysql_real_excape_string($tools) and stripslashes($tools) to no avail as you can see. Any ideas? $sql = " INSERT INTO project_tools (id,tool) "; $sql .= " VALUES ('$incident_id','$tools') "; $sql = " INSERT INTO project_tools (id,tool) "; $sql .= " VALUES ('$incident_id','" . stripslashes($tools) . "') "; $sql = " INSERT INTO project_tools (id,tool) "; $sql .= " VALUES ('$incident_id','" . mysql_real_excape_string($tools) . "') "; Quote Link to comment https://forums.phpfreaks.com/topic/49366-apostrophe-breaking-mysql-query/ Share on other sites More sharing options...
MadTechie Posted April 30, 2007 Share Posted April 30, 2007 i think you mean addslashes or htmlspecialchars if not try them Quote Link to comment https://forums.phpfreaks.com/topic/49366-apostrophe-breaking-mysql-query/#findComment-241898 Share on other sites More sharing options...
kenrbnsn Posted May 1, 2007 Share Posted May 1, 2007 The function is mysql_real_escape_string(), not mysql_real_excape_string(). After you generate the query, echo it to the screen to see if the quote character are escaped. Ken Quote Link to comment https://forums.phpfreaks.com/topic/49366-apostrophe-breaking-mysql-query/#findComment-242016 Share on other sites More sharing options...
MadTechie Posted May 1, 2007 Share Posted May 1, 2007 ow well spotted kenrbnsn, plus mysql_real_excape_string() should of returned an error, Quote Link to comment https://forums.phpfreaks.com/topic/49366-apostrophe-breaking-mysql-query/#findComment-242313 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.