Jump to content

Starting row index at a specific number


NiallAA
Go to solution Solved by NiallAA,

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.