if if else如果条件不能正常工作,请告诉我以下代码中是否有任何错误

In this code when i enter wrong password in the login panel it shows me the error "Your Account is deactivated by admin. Please contact Admin" but it should show the "Your Mobile or Password is invalid. Login Again!" is there any mistake in the if condition please anyone help me regarding this.

<?php
       include("../includes/db.php");
       session_start();

       if($_SERVER["REQUEST_METHOD"] == "POST") {
          // username and password sent from form 

          $mobile = mysqli_real_escape_string($con,$_POST['mobile_l']);
          $mypassword = mysqli_real_escape_string($con,$_POST['password']); 

          $sql = "SELECT * FROM agent_profile WHERE mobile = '$mobile' and password = '$mypassword'";

          $result = mysqli_query($con,$sql);

          $row = mysqli_fetch_array($result,MYSQLI_ASSOC);

          $count = mysqli_num_rows($result);

          $status = $row['status'];

          // If result matched $myusername and $mypassword, table row must be 1 row

          if($count == 1 && $status==1) {

             $_SESSION['login_user'] = $mobile;

             header("location: donor_list.php");
          }

              elseif($status==0)
          {
              $error="Your Account is deactivated by admin. Please contact Admin";
          }



              else {
             $error = "Your Mobile or Password is invalid. Login Again!";


          }


       }
    ?>

Your logic is wrong. You must have $count=1 when the account is deactivated by the admin and if it doesn't find any record then it means that there is no record in the db and $count should be 0 and since you are forcefully assigning something to the $status so it might assign it 0 when there is no record. So to differentiate the second and third conditions change elseif($status==0) to elseif($status==0 && $count==1)

The problem lies in the line

elseif($status==0)

Since you only use two = signs, it will be true even if status is null (no rows are found). You could fix this by first checking if the count is 1 or by using three equal signs to also check for type differences. IMO the best solution would be to first check if there are any results and then do the further checks like this:

if ($count == 1){
    if ($status == 1){
        $_SESSION['login_user'] = $mobile;
         header("location: donor_list.php");
    }else{
        $error="Your Account is deactivated by admin. Please contact Admin";
    }
}else{
    $error = "Your Mobile or Password is invalid. Login Again!";
}