Taking the value from the top row of a while function
Posted: Fri Mar 25, 2005 7:31 pm
I want to have a table with data in that the top row is the main result and every row after it subtracts it's value from the to value, or the greatest value in the column in the Mysql table. so it would be like:
John 100 100
Matt 75 -25
Jimi 50 -50
Bart 25 -75
etc...
this is what i have so far...
Thanks
John 100 100
Matt 75 -25
Jimi 50 -50
Bart 25 -75
etc...
Code: Select all
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
// Alternate color schemes.
$row_color = ($row_count % 2) ? $color1 : $color2;
echo "<tr bgcolor=\"$row_color\">
<td align=\"left\" >$row[0]</td>
<td align=\"left\" >$row[1]</td>
<td align=\"left\" >$row[2]</td>
<td align=\"left\" >$row[3]</td>
<td align=\"center\" >$row[4]</td>
<td align=\"center\" >$row[5]</td>
";
$row_count++;
}Thanks