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


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


    ?>

4

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