Actually you dont need to keep track of the row number. Yoy could just
alternate the two colors like this:
while ( $row = mysql_fetch_array($result) )
{
$bgCol = ( $bgCol == "#EADBC6"}?"#EFE1CE":"#EADBC6";
echo "......";
}
hth Henrik Hornemann
-----Oprindelig meddelelse-----
Fra: Patrick Lebon [mailto:[EMAIL PROTECTED]]
Sendt: 26. september 2002 17:20
Til: [EMAIL PROTECTED]
Emne: Re: [PHP-DB] Current row of query
Thanks, im currently doing something similar to this but I was wondering if
there was an already defined variable that i could use rather then have to
create a value and increment it myself. I guess am being picky, but was just
curious as im new to php.
This is how im currently doing it...
$rowNum = 0;
while ( $row = mysql_fetch_array($result) )
{
$rowNum++;
if ($rowNum % 2) { $bgCol = "#EADBC6"; } else { $bgCol = "#EFE1CE"; }
echo "......";
}
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php