Q:

mysql_select_db() expects parameter 2 to be resource, object given PHP validation

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."; 

? >

A:

Replace your code with this . 
   <? 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"];

mysqli_select_db($db,"car_rental");
$result = mysqli_query($db,"SELECT email, users FROM users WHERE email =$email");

//$row = mysql_fetch_array($result);
  $row = $result->fetch_array(MYSQLI_ASSOC);
 if($row["email"]==$email && $row["pass"]==$pass)
    echo"You are a validated user."; 
   else
     echo"Sorry, your credentials are not valid, Please try again."; 

    ? >

