<?php
session_start();
$message ="";
$connect = mysqli_connect("localhost", "root","", "testdb");
if(isset($_POST['login']))
{
if(empty($_POST["email"]) && empty($_POST["password"]))  
      {  
           echo '<script>alert("Both Fields are required")</script>';  
      }  
      else  
      {  
           $uemail = mysqli_real_escape_string($connect, $_POST["email"]);  
           $upassword = mysqli_real_escape_string($connect, $_POST["password"]);  
           $upassword = md5($upassword);  
           $query = "SELECT * FROM users1 WHERE email = '$uemail' AND password = '$upassword'";  
           $result = mysqli_query($connect, $query);  
          $count=mysql_num_rows($result) ;
          if($count=1)
          {
              $role= mysql_fetch_array($result);
              if($role == "admin")
              {
                  header("location: index2.php");
                  exit();
              }
              elseif($role == "user")
            {
              header("location: index3.php");
              exit();
              }
          }
          else
          {
              echo "wrong email and password";
          }
      } 
 }   ?>
I am trying to redirect the login.php to different pages according to the role.
I have role as enum i.e 'admin','user' unfortunately i am getting this error.. I have even checked the $query.
It has no syntax errors.. but it is unable to fetch the data to $role.
Warning: mysql_num_rows() expects parameter 1 to be resource, object given in /Applications/XAMPP/xamppfiles/htdocs/p51/login.php on line 20 wrong email and password
 
    