why not if (!($1%2)) { echo "even!"; } else { echo "odd!"; }
Adam On Thu, 26 Sep 2002, Brad Bonkoski wrote: > oops... > > I meant: > (if $i is odd) > ... > > because $i would be the current index in the array. > > > Brad Bonkoski wrote: > > > why not this? > > > > $result = mysql_query("Select * from table'); > > $num_rows = mysql_num_rows($rows); > > > > for ($i=0; $i<$num_rows, $i++) > > { > > $row = mysql_fetch_array($result); > > if ($num_rows is odd) > > { > > print $row with BG color of red; > > } > > else > > { > > printf $row with BG color of purple; > > } > > } > > > > HTH > > -Brad > > > > Patrick Lebon wrote: > > > > > Is there a mysql or array variable for the current row of a query array? > > > I want to alternate background colours for each row of the query output so i > > > need to know the current row number. > > > > > > Thanks > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php