If you are using mysql to search the database for matches, then use something like below
$email = $mysqli->escape_string($_POST['email']);
$password = $mysqli->escape_string($_POST['password']):
$result = $mysqli->query("SELECT * FROM users WHERE email="$email" AND password='$password'");
//check whether the user exists and redirecting if not exists
if ($result-> num_rows == 0){
$_SESSION['messege']= "You have entered Either Wrong Username or Password ";
header("location: error.php");
}
3
solved Displaying an error message in PHP [closed]