When I try to insert a sentence with an apostrophe or line break to the database I get an error. { $sql_query = "INSERT INTO `filedetails` (`type`,`title` , `description` , `links` ) VALUES ('$chosenFileType','$title','$description','$linksCollection')"; $query_result = mysql_query($sql_query) or die(mysql_error()); } PHP: this is the code for inserting into the database. What can I do to solve this problem? Thanks all.
Seconded. You will probably find a lot of things that say addslashes(), but mysql_real_escape_string() catches a couple of things that mysql will convert to apostrophes and mess your stuff up. Also in reverse, when you pull this data out of the database, stripslashes() should be used so it gets rid of all the extra stuff.