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/gd ms/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($resul t, $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
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/gd
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($resul
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for everyones suggestions,
im implementing them now - ill let you know how it goes
cheers
im implementing them now - ill let you know how it goes
cheers
ASKER
Thanks guys - through your suggestion you forced me to go over the GET building code - stupid mistake.
thanks fior the suggestions though very useful.
thanks fior the suggestions though very useful.
http://www.php.net/mysql_data_seek