Hello,
I have a set of records in a mysql database and am trying to make select next and previous buttons on a webpage. I have issues coding it in php however; any help is greatly appreciated.
My records do not have auto increment id attached to them.
My code is as follows:
$result = mysql_query($query) or die("Couldn't execute query");
$row_number = 1;
while ($row = mysql_fetch_assoc($result)) {
$row_number ++;
if ($row_number <= mysql_num_rows($result)) {
$nextRecord=mysql_data_seek($result,$row_number);
while ($nextRow = mysql_fetch_row($nextRecord)) {
echo $nextRow['family_accession_number'];}
when I try to run the script, the following message came out:
Warning: mysql_data_seek() [function.mysql-data-seek]: Offset 2 is invalid for MySQL result index 3 (or the query data is unbuffered) in C:\xampp\htdocs\survey\continuetitle.php on line 23
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\survey\continuetitle.php on line 25
Line 23 is: $nextRecord=mysql_data_seek($result,$row_number);
Thanks!
EDIT:
I changed while ($nextRow = mysql_fetch_row($nextRecord)) {
to
while ($nextRow = mysql_fetch_row($result)) {
but the same error occurs on line 23
EDIT:
Found error in SQL query which returns only one row.