Link to home
Start Free TrialLog in
Avatar of grubmaker
grubmaker

asked on

problems with mysql_data_seek and a php browse function

hi

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)))
      showerror();
      
$rowsFound = @ mysql_num_rows($result);
      
      if($rowsFound != 0)
      {
            $previousOffset = $rowOffset - ROWS;
            $nextOffset = $rowOffset + ROWS;
            
            if(!mysql_data_seek($result, $rowOffset))
                  showerror();
            

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.

cheers


Avatar of indigostark
indigostark

Read this hope it helps.
http://www.php.net/mysql_data_seek
ASKER CERTIFIED SOLUTION
Avatar of WysG
WysG
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of grubmaker

ASKER

thanks for everyones suggestions,

im implementing them now - ill let you know how it goes

cheers
Thanks guys - through your suggestion you forced me to go over the GET building code - stupid mistake.
thanks fior the suggestions though very useful.