We help IT Professionals succeed at work.
Get Started

problems with mysql_data_seek and a php browse function

grubmaker asked
Last Modified: 2013-12-12

im trying to implement a generic browse function for my web database.
the function works fine when displaying the first 20 rows (it displays 20 rows to one page) and provides the correct Next link with what looks like the correct GET URL parameters.
However when you select Next the following error appears:

Warning: mysql_data_seek(): Offset 20 is invalid for MySQL result index 7 (or the query data is unbuffered) in /home/wdnas/public_html/gdms/browse.php on line 18
Error 0 :

heres the code:

define(ROWS, 20);

function browse($scriptName, $connection, $browseString, $rowOffset, $query, $pageHeader,
                        $header, $tablename, $tablefile, $tablecss)
 if(!($result = @ mysql_query ($query, $connection)))
$rowsFound = @ mysql_num_rows($result);
      if($rowsFound != 0)
            $previousOffset = $rowOffset - ROWS;
            $nextOffset = $rowOffset + ROWS;
            if(!mysql_data_seek($result, $rowOffset))

the rest of the code is for outputing the html......
something which is confusing me is no matter how many rows i have to display the error always refers to result index 7.
if anyone can point in me in the right direction, id be very grateful, its really slowing me down.


Watch Question
This problem has been solved!
Unlock 2 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE