emopoops Posted November 21, 2009 Share Posted November 21, 2009 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 https://forums.phpfreaks.com/topic/182370-mysql_real_escape_string-making-variable-equal-nothing/ Share on other sites More sharing options...
mikesta707 Posted November 21, 2009 Share Posted November 21, 2009 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 https://forums.phpfreaks.com/topic/182370-mysql_real_escape_string-making-variable-equal-nothing/#findComment-962381 Share on other sites More sharing options...
emopoops Posted November 21, 2009 Author Share Posted November 21, 2009 oh sure thats probably it. didnt think of it, i just started a new page and added it and it wouldnt post i was like wtf. Link to comment https://forums.phpfreaks.com/topic/182370-mysql_real_escape_string-making-variable-equal-nothing/#findComment-962383 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.