I have a table with primary key 'Id' of varchar type. I want to select the next row when user clicks next record, in php, for example
1st row id= 'a'
2nd row id= 'b'
3rd row id='h'
4th row id='z'
Im currently on page with get variable id='a'
I want to get the next which is 'b', then 'h' then 'z'
The first record is easy as I send page.php?id='a' to display
table records.
The next record,
Select id from table where id > 'a'
But I dont want 'h' or 'z' because 'b' is next.
I dont have a clue, any help will be appreciated
Best Answer
Breaking that down:
that bit is hopefully obvious
you don't want the current value or anything before it
in the output, list earlier ID values first
we only want one of them so no point going further once one has been ready from the table.
As an aside: is there a any particular reason why you are using a character field as the ID instead of a numeric one which would be more efficient?