Pjack125 Posted January 23, 2009 Share Posted January 23, 2009 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 More sharing options...
premiso Posted January 23, 2009 Share Posted January 23, 2009 $Query1a = "SELECT * FROM STEPS WHERE STEPNO = ".$steps."; "; $result = mysql_query($Query1a); if (mysql_num_rows($result) < 1) { echo "{$steps} does not exist."; } mysql_num_rows Link to comment https://forums.phpfreaks.com/topic/142118-geting-the-next-record-in-sql/#findComment-744363 Share on other sites More sharing options...
Pjack125 Posted January 23, 2009 Author Share Posted January 23, 2009 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 Link to comment https://forums.phpfreaks.com/topic/142118-geting-the-next-record-in-sql/#findComment-744411 Share on other sites More sharing options...
Mark Baker Posted January 23, 2009 Share Posted January 23, 2009 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 You could take a look at PHPLinq, which is a PHP implementation of C#3.0's LINQ (Language Integrated Query) Link to comment https://forums.phpfreaks.com/topic/142118-geting-the-next-record-in-sql/#findComment-744448 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.