gilespatrickson Posted November 18, 2011 Share Posted November 18, 2011 Hello and thanks in advance for the input. I a fully functioning form. I am validating the input and successfully inserting the input into the mysql database. Now I am trying to escape the data by adding the basic line of code: $name = mysql_real_escape_string($_POST['name']); The input is successful but the mysql_database for name field is empty. If I remove the above line of code and just input the value for $name (without escape) the update works great. So the question is obvious for the above. Why? Quote Link to comment https://forums.phpfreaks.com/topic/251387-mysql_real_escape_string/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 18, 2011 Share Posted November 18, 2011 You need a connection to the database server before you can use mysql_real_escape_string. You should also have php's error_reporting set to E_ALL and display_errors set to ON so that php would be reporting and displaying all the errors it detects. You would be getting connection errors at the mysql_real_escape_string statement because it attempts to create a connection when a connection does not already exist. Quote Link to comment https://forums.phpfreaks.com/topic/251387-mysql_real_escape_string/#findComment-1289343 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.