RE: [PHP-WIN] Alternate table rows
| From: | Davy Obdam | Date: | Fri, 04 Oct 2002 19:22:04 +0000 |
| Subject: | RE: [PHP-WIN] Alternate table rows | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16175@lists.php.net to get a copy of this message | ||
Hi Dash,
Thanks it works!
Best regards,
Davy Obdam
mailto:info@davyobdam.com
-----Original Message-----
From: Dash McElroy [mailto:dash.php@westonefcu.org]
Sent: Friday, October 04, 2002 1:53 AM
To: 'Davy Obdam'; php-windows@lists.php.net
Subject: RE: [PHP-WIN] Alternate table rows
phpMyAdmin does it like this:
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] :
$cfg['BgcolorTwo'];
Obviously you'd have your $cfg['BgcolorOne'] and $cfg['BgcolorTwo'] set
to different colors, or change those variables right there.
-Dash
-----Original Message-----
From: Davy Obdam [mailto:info@davyobdam.com]
Sent: Thursday, October 03, 2002 4:48 PM
To: Php-Windows Mailing
Subject: [PHP-WIN] Alternate table rows
Hi people,..
I have a table wich is created with php and ofcourse the data comes from
a database. To make it more readable i would like to alternate the color
of each table row. For instance 1st row:#efefef 2nd row:#d3d3d3 and so
on... Does anyone knows a solution..? I am now using the folowing piece
of code:
<?php
$select = mysql_query("SELECT * FROM products ORDER BY name ASC LIMIT
$start,10"); for ($i=0;$i<mysql_num_rows($sql_id);$i++)
{
$sql = mysql_fetch_assoc($select);
//Table
echo "
<table cellpadding=\"2\" cellspacing=\"1\"
bgcolor=\"#ffffff\">\n
<tr>\n
<td bgcolor=\"#efefef\">".sql['products']."</td>\n//First
row
</tr>\n
<tr>\n
<td bgcolor=\"#efefef\">Second row</td>\n
</tr>\n
</table>\n";
}
?>
Well u get the idea i think, can anyone help me. Any help is greatly
appreciated.;-)
Regards,
Davy Obdam
mailto: info@davyobdam.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
================================================================
Deze e-mail is door E-mail VirusScanner van Planet Internet
gecontroleerd op virussen. Op http://www.planet.nl/evs staat
een
verwijzing naar de actuele lijst waar op wordt gecontroleerd.