title: PHP: cannot loop through mysql rows more than once
body: <p>I'm working on pagination, and for some reason I cannot use mysql_fetch_array to loop through a result more than once.</p>
  
  <pre><code>//both $page and $imagesPerPage != 0
  $offset = $page * $imagesPerPage
  while ($row = mysql_fetch_array($result)) {
     $total_images++;
  }
  echo $total_images;
  //echos correct amount
  $row = null;
  
  
  $images_to_offset = 0;
  while ($row = mysql_fetch_array($result) &amp;&amp; $images_to_offset &lt; $offset) {
     $images_to_offset++;
  }
  echo $images_to_offset;
  //echos 0... which is wrong
  </code></pre>
  
  <p>Should I be using a different php function to get row data in a database?</p>
  
  <p>Thanks!</p>