Find/Display Current/Next Number
Posted: Mon Nov 07, 2005 10:44 am
I have been trying to create a query that will do two things.
First, it checks against $_GET to select and display the proper
number being requested.
Second(the part I cant figure out) it needs to use the current $_GET
value, then check against the current available numbers, then select
and display the next number available... that is closet to the current number.
Example would be:
I am on 10,
The next number is 11.....
sql correctly selects and gets 11 for me.
After 11, the next number is 14.
I need sql to realize next is not in sequence, but still choose the next
number above 11, and display it.
I was thinking about just changing the SELECT
SELECT * FROM table WHERE id =1
so that it first selects the number, then finds and selects the next highest number.
Can this be done?
btw.... this is not being used as auto-inc field...
if so, then there would be no prob
First, it checks against $_GET to select and display the proper
number being requested.
Second(the part I cant figure out) it needs to use the current $_GET
value, then check against the current available numbers, then select
and display the next number available... that is closet to the current number.
Example would be:
I am on 10,
The next number is 11.....
sql correctly selects and gets 11 for me.
After 11, the next number is 14.
I need sql to realize next is not in sequence, but still choose the next
number above 11, and display it.
I was thinking about just changing the SELECT
SELECT * FROM table WHERE id =1
so that it first selects the number, then finds and selects the next highest number.
Can this be done?
btw.... this is not being used as auto-inc field...
if so, then there would be no prob