title: if ELSE statement not working correctly in while loop
body: <p>In my while loop I am able to correctly do the first part of the if statement but the ELSE will not work, I can get everything to work correctly so I get the string and I match it against the string in the db and if the string is correct I get the correct output too but if the string does not match I can't get the else statement to work so to just echo out that the string does not match. </p>
  
  <pre><code>if(isset($_POST['submit'])) {
  
  $search_query = escape_string($_POST['search_query']);
  
  $query = "SELECT client_id, client_name, status FROM clients WHERE client_id = '".$search_query."' ";
  $result = mysqli_query($connection, $query);
  if($result &amp;&amp; !empty($search_query)) {
  
      while($code = mysqli_fetch_assoc($result)) {
  
          if($_POST['search_query'] === $code['client_id']) {
              echo $code['client_name'] . " " . $code['client_id'] . " " . $code['status'];   
          } else {
              echo $_POST['search_query'] . " ID does not exist!";
          }
  
      }
  
  } 
  </code></pre>
  
  <p>} </p>
  
  <p>This is the form:</p>
  
  <pre><code>&lt;form action="search.php" method="post"&gt;
  
      &lt;p&gt;
          &lt;input type="text" name="search_query" id="search" /&gt;
          &lt;input type="submit" name="submit" value="SEARCH" /&gt;
      &lt;/p&gt;
  
  &lt;/form&gt;
  </code></pre>