Jump to content

Geting the next Record in SQL


Pjack125

Recommended Posts

I am trying to navigate trough a table using SQL. I created a diagram that displays mulitple steps in a process located here (http://www.pixelfxmedia.com/steps.php) what i am trying to achieve it to go from step 1-2 to 1.3 using a dynamic hyperlink so in the end i'll probably have http://www.pixelfxmedia.com/steps.php?step=1-3

 

I currently have the statement

$Query1a =	"SELECT * FROM STEPS WHERE STEPNO = ".steps."; ";

which returns the record for row 3 in my table (step 1-2). what i want to do is see if there is a record after 1-2 if there is then i display the link http://www.pixelfxmedia.com/steps.php?step=1-3  where 1-3 is the value of the next record  if not then i just echo a message saying there is no more steps.

 

I know i don't explain things too well but please work with me

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/142118-geting-the-next-record-in-sql/
Share on other sites

is there a way to get the row number? lets say we have  3 results from a a query

query 1

-------

1. bob

2. Lisa

3. Amy

 

lest say i want to find out what row number lisa is in my array

is there sort of a

Get rowNumber where Name = Lisa

so then after that i can just set that value to a variable

$numb = the row number +1

and then run something like

get name where rowNumber = $numb

then get that name value and store it to a varialbe

after that do file.php?=name

 

thats the gist of what i'm trying to do. this way i can trying to do

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.