NiallAA Posted December 10, 2015 Share Posted December 10, 2015 Hi all, I am trying to display a set of results in a table, and use the MySQL row index as a numbered bullet as the first column in each row. However, I intend to use two sets of six results. The first set of results should be numbered 1 to 6, the second set 7 to 12. At the moment, it returns 1 to 6, followed by another 1 to 6, understandably. Is there something simple I could be doing to the second query to change the index so that it starts at 7? Here is the code I am using to display the result of the second query: $j=1; $i=0; while($i< $qty) { if(isset($draw_line)) { for($k = 0 ; $k < sizeof($draw_line) ; $k++) { if($draw_line[$k] == $i) { $templine_width = $tb_width-20; echo" <tr> <td height=\"5\" colspan=\"20\" align=\"center\" valign=\"middle\"> <img src=\"images/line.gif\" width=\"$templine_width\" height=\"5\" ALT=\"\"><br> </td> </tr> "; } } } echo" <tr style=\"border-top: 0.5px;\"> <td align=\"left\" valign=\"middle\" bgcolor=\"$bg1\"><b>$j.</b></td> <td align=\"left\" valign=\"middle\" bgcolor=\"$bg1\"> "; if($team[$i] == "Dundee United") echo"<b>UNITED</b>"; else echo"<a href=\"opponent.php?opp=$teamid[$i]\">$team[$i]</a>"; echo" </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg2\">$pld[$i]</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg1\">$wins[$i]</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg1\">$draws[$i]</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg1\">$loses[$i]</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg1\">$goals_for[$i]</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg1\">$goals_against[$i]</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg1\">$diff[$i]</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$bg2\">$points[$i]</td> </tr> "; $i++; $j++; } Niall Quote Link to comment https://forums.phpfreaks.com/topic/299694-starting-row-index-at-a-specific-number/ Share on other sites More sharing options...
Solution NiallAA Posted December 10, 2015 Author Solution Share Posted December 10, 2015 As quick as I posted this I sussed it out. $j = 7; Quote Link to comment https://forums.phpfreaks.com/topic/299694-starting-row-index-at-a-specific-number/#findComment-1527767 Share on other sites More sharing options...
Barand Posted December 10, 2015 Share Posted December 10, 2015 Given the total absence of database-related code moved from mysql to php help Quote Link to comment https://forums.phpfreaks.com/topic/299694-starting-row-index-at-a-specific-number/#findComment-1527769 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.