<?php
session_start();
include('config.inc'); //for selecting database and connecting to phpmyadmin
$redirect_page = "Login_page.php";
if(isset($_POST['email']) && isset($_POST['password'])){
$email = $_POST['email'];
$password =$_POST['password'];
//$_SESSION['email'] = $email;
//$_SESSION['password'] = $password;
if((!empty($email)) && (!empty($password))){
$query = "SELECT * FROM 'login_details' WHERE (email ='".mysql_real_escape_string($email)."') AND (password ='".mysql_real_escape_string($password)."')";
$sql_query_run = mysql_query($query);
if(mysql_num_rows($sql_query_run) == 1){
echo "<div>login Success</div>";
}
else{
echo "<div>Invalid</div>";
}
}
else{
header ('Location:'.$redirect_page);
}
}
?>
I am working on Localhost using Xampp. The above code does not check the required inner most "if" condition, i get a Warning and it outputs "Invalid" that is the inner most "else" part even if i have entered correct email and password that are present in my database. The Warning says:Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\check_user.php on Line 40 The above code is in check_user.php page and i have a different login page (Login_page.php) that has a html form with method ="post" and action ="user_check.php". Please Help...