Jump to content

mysql_real_escape_string


gilespatrickson

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/251387-mysql_real_escape_string/
Share on other sites

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.