Jump to content

mysql_real_escape_string making variable equal nothing


emopoops

Recommended Posts

i post a form and i post the variable:

$var = $_POST[variable];

then i echo $var its what i submitted the variable to be.

then i add the mysql_real_escape_string() function to it

spell it correctly too

\

$var = mysql_real_escape_string($_POST[variable]);

then i echo the variable it equals nothing?

why?

is it because i havent added a mysql query on yet or what?

do you have error reporting on?

ini_set('display_errors', 1);
error_reporting(E_ALL);

 

have you connected to a mysql database? mysql_real_escape_string() needs a link identifier to work, without it it returns false (actually a little more happens, but you can read about it in the manual) You can also try var_dump() on your variable to see if it actually an empty string, or just a boolean false

 

mysql_real_escape_string()

 

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.