I am trying to validate a user login using PHP, however i get the following errors
Warning: mysql_select_db() expects parameter 2 to be resource, object given in C:\xampp\htdocs\db\sign_in_connect.php on line 18
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\db\sign_in_connect.php on line 22 Sorry, your credentials are not valid, Please try again.
this is my PHP code
<?php
try{
$db = mysqli_connect ('localhost', 'root', '', 'car_rental') or die ("SQL is Off");
}
catch (Exception $e){
echo "SQL is Off";
exit;
}
echo "success";
$email = $_POST["email"];
$pass = $_POST["pass"];
mysql_select_db("car_rental",$db);
$result = mysql_query("SELECT email, users FROM users WHERE email = $email");
$row = mysql_fetch_array($result);
if($row["email"]==$email && $row["pass"]==$pass)
echo"You are a validated user.";
else
echo"Sorry, your credentials are not valid, Please try again.";
?>