ecabrera Posted November 12, 2011 Share Posted November 12, 2011 Warning: mysql_real_escape_string() [FUNCTION.MYSQL-REAL-ESCAPE-STRING]: if($_POST['loginbtn']){ $email = (mysql_real_escape_string($_POST['email'])); $password = (mysql_real_escape_string($_POST['password'])); Link to comment https://forums.phpfreaks.com/topic/251007-i-keep-geting-a-warning/ Share on other sites More sharing options...
QuickOldCar Posted November 12, 2011 Share Posted November 12, 2011 Either you are not making a connection to mysql database first, or it can not reconnect to it. Link to comment https://forums.phpfreaks.com/topic/251007-i-keep-geting-a-warning/#findComment-1287634 Share on other sites More sharing options...
ecabrera Posted November 12, 2011 Author Share Posted November 12, 2011 <?php if($_POST['loginbtn']){ $email = (mysql_real_escape_string($_POST['email'])); $password = (mysql_real_escape_string($_POST['password'])); if($email && $password){ //connection to db require 'scripts/connect.php'; $password = md5("$password"); $query = mysql_query("SELECT * FROM admin WHERE email='$email'"); $numrows = mysql_num_rows($query); if($numrows != 0){ $rows = mysql_fetch_assoc($query); $dbemail = $rows['email']; $dbpassword = $rows['password']; if($password==$dbpassword){ $_SESSION['email'] = $dbemail; echo "<body onLoad=\"setTimeout('redirect();', 1000);\">"; echo "<center><font color='white'>Being Redirected......Please wait</font></center>"."<br/>"; }else $error = "<font color=white><b>You enter a incorrect password</b></font>"; }else $error = "<font color=white><b>This person does not exist</b></font>"; }else $error = "<font color=white><b>You did not fill in all the fields</b></font>"; } ?> Link to comment https://forums.phpfreaks.com/topic/251007-i-keep-geting-a-warning/#findComment-1287635 Share on other sites More sharing options...
Pikachu2000 Posted November 12, 2011 Share Posted November 12, 2011 The db connection has to be established before you can use mysql_real_escape_string, like it says in the manual. Link to comment https://forums.phpfreaks.com/topic/251007-i-keep-geting-a-warning/#findComment-1287636 Share on other sites More sharing options...
ecabrera Posted November 12, 2011 Author Share Posted November 12, 2011 ok thanks Link to comment https://forums.phpfreaks.com/topic/251007-i-keep-geting-a-warning/#findComment-1287639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.