title: mysqli query results to show all rows
body: <p>I have the following code:</p>
  
  <pre class="lang-php prettyprint-override"><code>include $_SERVER['DOCUMENT_ROOT'].'/include/conn.php'; 
  
  $query = "SELECT title FROM news_event";
  $result = $mysqli-&gt;query($query);
  $row = $result-&gt;fetch_array(MYSQLI_BOTH);
  $row_cnt = $result-&gt;num_rows;
  $result-&gt;free();
  $mysqli-&gt;close();
  </code></pre>
  
  <p>This is fine if there is only one result as I can just echo <code>$row['title']</code> but if there are lots of results, how do I get this to loop through and print every row?</p>
  
  <p>I'm sure this is really simple but I'm just not sure what I need to search for in Google.</p>
  
  <p>I'm looking for a <code>mysqli</code> equivalent of this:</p>
  
  <pre class="lang-php prettyprint-override"><code>while( $row = mysql_fetch_array($result) )
  {
      echo $row['FirstName'] . " " . $row['LastName'];
      echo "&lt;br /&gt;";
  }
  </code></pre>