I have nested if conditions on my project but i have a problem;
if(isset($_GET['q']) && isset($_GET['t'])) {
  $query = $_GET['q'];
  $type = $_GET['t'];
  $none_key = FALSE;
  if($type = 'singer') {
      $singers = $connect->query("SELECT * FROM lyrica_singers WHERE singer_name LIKE '%$query%'");
      $control = $singers->rowCount();
      if($control > 0)  {
        $on_page = 24;
        $number_singers = $singers->rowCount();
        $number_page = ceil($number_singers/$on_page);
        $page = isset($_GET['p']) ? (int) $_GET['p'] : 1;
        if ($page < 1) $page = 1;
        if ($page>$number_page) $page = $number_page;
        $limit = ($page - 1) * $on_page;
        $singers = $connect->query("SELECT * FROM lyrica_singers WHERE singer_name LIKE '%$query%' ORDER BY singer_name ASC LIMIT ".$limit.",".$on_page);
        $singer_key = TRUE;
      } else {
        $none_key = TRUE;
      }
    }
    if($type = 'song') {
      $songs = $connect->query("SELECT * FROM lyrica_songs WHERE song_name LIKE '%$query%'");
      $control = $songs->rowCount();
      if($control > 0)  {
        $on_page = 24;
        $number_songs = $songs->rowCount();
        $number_page = ceil($number_songs/$on_page);
        $page = isset($_GET['p']) ? (int) $_GET['p'] : 1;
        if ($page < 1) $page = 1;
        if ($page>$number_page) $page = $number_page;
        $limit = ($page - 1) * $on_page;
        $songs = $connect->query("SELECT * FROM lyrica_songs WHERE song_name LIKE '%$query%' ORDER BY song_name ASC LIMIT ".$limit.",".$on_page);
        $song_key = TRUE;
      } else {
        $none_key = TRUE;
      }
    }
} else {
  $key = TRUE;
}
When I run the code, I am expecting that if one of the'control' variables is bigger than 0 the 'none_key' variable must be equal to 0. When the 'type' varible is 'song' there is no problem but if the 'type' variable is 'singer' then 'none_key' variable printing 1, I think it is running the second if block and becomes 'none_key' 1 because of the second 'control' variable is not bigger than zero.
 
    