Wonderful little PHP problem.

Soldato
Joined
26 Jun 2009
Posts
3,023
Location
Sheffield
Hi there, I'm using this little bit of code:

Code:
$id = $_REQUEST['id'];
$id = mysql_real_escape_string($id);
echo $id;

The $id just contains a number, in fact any number that I care to put into it, but for some reason when the 2nd isn't commented out, it empties the variable?

I've paired the script right down so that is literally all that is left PHP wise.

If I remove the 2nd line, it displays whatever is in the $id. If I change mysql_real_escape_string to strip_slashes, then it works. :s

Just wondering if anyone can help? I've got to be missing something, I've never had a problem like this before. :(
 
Last edited:
Cheers guys but the duy in the first post had it! I have a require_once() that has all the connection data and the link was broken. :P
 
Back
Top Bottom