This php code is not working as intended, where is the error?

$sql = “SELECT * FROM login WHERE username = ‘$username’ and password = ‘$password’ and role=‘admin’”;
$result = mysqli_query($link,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);

$count = mysqli_num_rows($result); 

    if($count == 1){ 
header("location: ./admin/index.php"); 
exit(); 
 }else{ 

   $sql = "SELECT * FROM login WHERE username = '$username' and password = '$password' and role='user'"; 
   $result = mysqli_query($link,$sql); 
   $row = mysqli_fetch_array($result,MYSQLI_ASSOC); 

   $count = mysqli_num_rows($result); 
       if($count == 1){ 
            $_SESSION['user'] = $row['username']; 
header("location: ./attorney/index.php");