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) . "') "; 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 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 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, Link to comment https://forums.phpfreaks.com/topic/49366-apostrophe-breaking-mysql-query/#findComment-242313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.