title: PHP - Pagination - Why am I getting this error : Unable to jump to row 0 on MySQL result index 13?
body: <p>I am having problems with paging some results drawn from a Mysql database.</p>
  
  <p>This is the code relating to the pagination:</p>
  
  <pre><code>    $max_results = 20; //Max listed query results
  
  if(!isset($_GET['pg'])){ $pg = 1; } else { $pg = $_GET['pg']; }
  $from = (($pg * $max_results) - $max_results);
  
  /// START of MySQL results – Page numbering
  $space_separated = implode(" ", $keywords_array);
  /// Count total
  $totals = mysql_result(mysql_query("SELECT COUNT(id)
              FROM products
              WHERE MATCH (`desc`)
              AGAINST ('".$space_separated."' IN BOOLEAN MODE)
              ORDER BY `desc`
              LIMIT $from, $max_results"),0);
  $total_pgs = ceil($totals / $max_results);
  $tempVar = 0; //Used in the generation of order form
  
  ///Now we search for our search term, in the field the user specified 
  
  // Page limiter &amp; result builder
  
  $dataQuery = "SELECT id, `desc`, price1, pack, measure, quantity
                FROM products
                WHERE MATCH (`desc`)
                AGAINST ('".$space_separated."' IN BOOLEAN MODE)
                ORDER BY `desc`
                LIMIT $from, $max_results";
  $result1 = mysql_query($dataQuery);
  $num_sql = mysql_num_rows ($result1);
  $data = mysql_query($dataQuery) or die(mysql_error());
  
  $pageContent .= '
  &lt;div&gt;
  &lt;p&gt;Results: '.$totals.'&lt;/p&gt;
  &lt;p&gt;Viewing page '.$pg.' of '.$total_pgs.'&lt;/p&gt;
  &lt;/div&gt;
  &lt;!-- end .aliLeft --&gt;&lt;/div&gt;
  ';
  
  $pageContent .= '
  &lt;p&gt;'.$paginator.'&lt;/p&gt;
  ';
  
  /// Display results
  if ($num_sql &gt; 0 ) {$i=0;
  while ($i &lt; $num_sql) {
  $holsite = mysql_result($result1,$i,"desc");
  $pageContent .= ''.$holsite.'';
  ++$i;}}
  
  $pageContent .= '
  &lt;p&gt;'.$paginator.'&lt;/p&gt;
  ';
  </code></pre>
  
  <p>I am adapting it from this tutorial : <a href="http://www.webdesign-4-beginners.co.uk/web-design-blog/2009/12/mysql-results-page-numbering/" rel="nofollow">http://www.webdesign-4-beginners.co.uk/web-design-blog/2009/12/mysql-results-page-numbering/</a></p>
  
  <p>I am getting the following mysql error:</p>
  
  <p>Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 13 in /path-to/orders-layout.php on line 302</p>
  
  <p>Also, when viewing page 2 of two, the result count is blank, and the pagination does not show the page numbers, only "previous page". On page 1 of 2, everything looks as it should?
  Does anyone have any idea what I have done wrong with this?</p>