For some reason my PHP login script keeps returning "invalid email/password combination", yet i know I am entering the correct email and password. Does anyone see what I might be doing wrong?
<?php
$email= $_POST['email'];
$password= $_POST['password'];
if (!empty($email) && !empty($password)) {
$connect= mysqli_connect("localhost", "root", "", "si") or die('error connecting with the database');
$query= "SELECT user_id, email, password FROM users WHERE email='$email' AND
password='$password'";
$result= mysqli_query($connect, $query) or die('error with query');
if (mysqli_num_rows($result) == 1) {
$row= mysqli_fetch_array($result);
setcookie('user_id', $row['user_id']);
echo "you are now logged in";
} else {
echo "invalid username/password combination";
}
} else {
echo" you must fill out both username and password";
}
?>