note 69704 added to control-structures.for
| From: | mark at rugbyweb dot org | Date: | Sat, 16 Sep 2006 13:42:55 +0000 |
| Subject: | note 69704 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117243@lists.php.net to get a copy of this message | ||
This is a handy little script for alternating row colours.
<?php
$color1="#FFFFCC"; //First Colour
$color2="none"; // Second Colour
$row_count=0; //Set row_count to 0
while($m=mysql_fetch_array($query)) //SQL query
{
$row_count++;//Counts row_count
$row_color = ($row_count % 2) ? $color1 : $color2; //Gets the colour to be used
print "<tr style='background:{$row_color}'> //Sets the row colour.
}
?>
This very handy and easy to use.
----
Server IP: 203.202.10.60
Probable Submitter: 60.226.0.110
----
Manual Page -- http://www.php.net/manual/en/control-structures.for.php
Edit -- https://master.php.net/note/edit/69704
Del: integrated -- https://master.php.net/note/delete/69704/integrated
Del: useless -- https://master.php.net/note/delete/69704/useless
Del: bad code -- https://master.php.net/note/delete/69704/bad+code
Del: spam -- https://master.php.net/note/delete/69704/spam
Del: non-english -- https://master.php.net/note/delete/69704/non-english
Del: in docs -- https://master.php.net/note/delete/69704/in+docs
Del: other reasons-- https://master.php.net/note/delete/69704
Reject -- https://master.php.net/note/reject/69704
Search -- https://master.php.net/manage/user-notes.php