title: check if the query results empty row mysqli
body: <p>I am using this code, but I don't understand how to check if the query returns zero rows. How can I check that?</p>
  
  <pre><code>$results = $mysqli-&gt;query("SELECT ANNOUNCE_NUMBER,ANNOUNCEMENTS,ANNOUNCE_TYPE,POST_DATE FROM home WHERE ANNOUNCE_NUMBER NOT LIKE $excludewelcome AND ANNOUNCE_NUMBER NOT LIKE $excludenews ORDER BY ANNOUNCE_NUMBER DESC LIMIT $position, $items_per_group");
  if ($results) { 
      //output results from database
  
      while($obj = $results-&gt;fetch_object())
      {
          if($obj-&gt;ANNOUNCE_TYPE=='NEWSEVENTS')
          {
              $realstring='News and Events';
          }
          else
          {
          $realstring='Welcome Note';
          }
  
          echo '&lt;li id="item_'.$obj-&gt;ANNOUNCE_NUMBER.'"&gt;&lt;strong&gt;'.$realstring.'&lt;/strong&gt;&lt;/span&gt;';
          echo '&lt;br \&gt;'; 
          echo '('.$obj-&gt;POST_DATE.' ) &lt;span class="page_message"&gt;'.$obj-&gt;ANNOUNCEMENTS.'&lt;/span&gt;&lt;/li&gt;';
      }
  
  }
  </code></pre>