MySQL Forums
Forum List  »  Newbie

Re: Table showing data from a MySQL database
Posted by: Thomas Ljungstrom
Date: December 13, 2004 02:13PM

Hi!
Try a PHP forum
http://www.sitepoint.com/forums/forumdisplay.php?f=34

every other row different colour a common question
<?php

$content = array('Row 1', 'Row 2', 'Row 3', 'Row 4', 'Row 5');

echo "<table>\n";

$bg = ""; // Init $bg

foreach ($content as $value) {

$bg = ($bg == '#FF0000') ? '#00FF00' : '#FF0000';

echo "<tr>\n";
echo "<td style=\"background-color:$bg\">$value</td>\n";
echo "</tr>\n";

}

echo "</table>\n";

?>

Options: ReplyQuote


Subject
Written By
Posted
Re: Table showing data from a MySQL database
December 13, 2004 02:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.