gc40 Posted November 27, 2007 Share Posted November 27, 2007 When I try to update a php script that writes my form entries to the database it fails. It usually works, however, when I use the ' apostrophe, it crashes. What must I add to my code to allow the ' or ` symbol to be ignored and not crash the system? Quote Link to comment https://forums.phpfreaks.com/topic/79043-apostrophe-crashing-php-form-script/ Share on other sites More sharing options...
v08i Posted November 27, 2007 Share Posted November 27, 2007 use php function addslashes() http://in.php.net/manual/en/function.addslashes.php Quote Link to comment https://forums.phpfreaks.com/topic/79043-apostrophe-crashing-php-form-script/#findComment-400046 Share on other sites More sharing options...
kenrbnsn Posted November 27, 2007 Share Posted November 27, 2007 If you're using MySQL, it's better to use the function mysql_real_escape_string(), since it will escape any character that will cause problems when inserting values into the database. Ken Quote Link to comment https://forums.phpfreaks.com/topic/79043-apostrophe-crashing-php-form-script/#findComment-400166 Share on other sites More sharing options...
gc40 Posted November 27, 2007 Author Share Posted November 27, 2007 I end up doing this: Authenticate(); include ("../class/config.php"); include("./fckeditor/fckeditor.php") ; $submit=$_REQUEST['submit']; $Content_ID=$_REQUEST['Content_ID']; $del=$_REQUEST['del']; $Content_Meta_Description=$_REQUEST['Content_Meta_Description']; $Content_Meta_Keywords=$_REQUEST['Content_Meta_Keywords']; $Content_Title=$_REQUEST['Content_Title']; $Content_SubTitle=$_REQUEST['Content_SubTitle']; $Content_Body=$_REQUEST['Content_Body']; $Content_Full_Page=$_REQUEST['Content_Full_Page']; if(!get_magic_quotes_gpc()) { $Content_Meta_Description = addslashes($Content_Meta_Description); $Content_Meta_Keywords = addslashes($Content_Meta_Keywords); $Content_Title = addslashes($Content_Title); $Content_SubTitle = addslashes($Content_SubTitle); $Content_Body = addslashes($Content_Body); $Content_Full_Page = addslashes($Content_Full_Page); } if(isset($submit)) Quote Link to comment https://forums.phpfreaks.com/topic/79043-apostrophe-crashing-php-form-script/#findComment-400398 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.