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?

Link to comment
Share on other sites

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()

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.