title: MySQLi - What is the point of data_seek in this example?
body: <p>I am new to MySQLi and following some examples. I am unclear as to why the function data_seek() is being used here in the for loop. If I'm not mistaken, it returns true/ false depending on if there is data in the current row passed to it. I'm only confused because the code runs fine without it, so it appears. Here is the example:</p>
  
  <pre><code>&lt;?php
  
  require_once 'login.php';
  
  $connection = new mysqli($db_hostname, $db_username, $db_password,   $db_database);
  
  if($connection-&gt;connect_error) die("Connection error: " . $connection-&gt;connect_error);
  
  $query = "SELECT * FROM classics";
  $result = $connection-&gt;query($query);
  
  if(!$result) die($connection-&gt;error);
  
  $rows = $result-&gt;num_rows;
  
  for($i =0; $i &lt; $rows; ++$i)
  {
      $result-&gt;data_seek($i);    ///////////////////Why is this here?
      $row = $result-&gt;fetch_array(MYSQLI_ASSOC);
  
      echo 'Author: '     .$row['author']   .'&lt;br&gt;';
      echo 'Title: '      .$row['title']    .'&lt;br&gt;';
      echo 'Category: '   .$row['category'] .'&lt;br&gt;';
      echo 'Year: '       .$row['year']     .'&lt;br&gt;';
      echo 'ISBN: '       .$row['isbn']     .'&lt;br&gt;&lt;br&gt;';
  
  }
  
  $result-&gt;close();
  $connection-&gt;close();
  </code></pre>
  
  <p>?></p>