ecabrera Posted July 13, 2012 Share Posted July 13, 2012 can anyone explain what im doing wrong i get Warning: mysql_num_rows() expects parameter 1 Warning: mysql_fetch_assoc() expects parameter 1 <?php //decaling the error message $msg = ""; //checing if the submit button has been pressed if(isset($_POST['loginbtn'])){ //creating a connection include "db_con.php"; //getting the values of the user's email and password $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); //password into md5 $password = md5($password); //cheing to see if the enterd a email or password if($email){ //cheing to see if the enterd a email or password if($password){ //getting the user data $query = mysql_query("SELECT * FROM users WHERE email=$email"); $numrows = mysql_num_rows($query); //checking to see if user input email matches db email if($numrows == 1){ $get = mysql_fetch_assoc($query); $dbemail = $get['email']; $dbpassword = $get['password']; if($dbemail == $email){ if($dbpassword == $password){ $email = $_SESSION['email']; header('Location: homepage.php'); }else $msg = "Please check your password"; }else $msg = "Please check your email"; }else $msg = "No person with that email"; }else $msg = "No password enter"; }else $msg = "No email enter"; } ?> Link to comment https://forums.phpfreaks.com/topic/265630-login/ Share on other sites More sharing options...
scootstah Posted July 13, 2012 Share Posted July 13, 2012 The query failed, because you didn't put quotes around $email. $query = mysql_query("SELECT * FROM users WHERE email='$email'"); Link to comment https://forums.phpfreaks.com/topic/265630-login/#findComment-1361342 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.