Here's a slight alteration to Peter's code in "case" someone isn't familiar with switch statements. Ooh, such a bad pun, as if there's any other kind. <? $query = 'SELECT * FROM table $mysql_result = mysql_query($query, $link); while($row = mysql_fetch_array($mysql_result)) { switch ($row["event"] ) { case event_one: $bg = 'blue' break; case event_two: $bg = 'red' break; case event_three: $bg = 'green' break; default: $bg = 'white' } print '<tr bgcolor="'.$bg.'"> <td>da da da </td> </tr>'; }// end while ?> Edward Dudlik Becoming Digital www.becomingdigital.com ----- Original Message ----- From: "Peter Lovatt" <pjln1@sunmaia.net> To: "Christopher Lyon" <cslyon@netsvcs.com>; <php-db@lists.php.net> Sent: Tuesday, 17 June, 2003 17:42 Subject: RE: Select Statement with output in different colors. Try this $query = 'SELECT * FROM table $mysql_result = mysql_query($query, $link); while($row = mysql_fetch_array($mysql_result)) { switch ($row["event"] ) { case event_one: $bg = 'blue' break; case event_one: $bg = 'red' break; case event_one: $bg = 'green' break; default: $bg = 'white' } print '<tr bgcolor="'.$bg.'"> <td>da da da </td> </tr>'; }// end while HTH Peter -----Original Message----- From: Christopher Lyon [mailto:cslyon@netsvcs.com] Sent: 17 June 2003 22:35 To: php-db@lists.php.net Subject: Select Statement with output in different colors. I have a php script that does some select statements, on mysql, and outputs that to a table. I would like to change the color of the table row depending upon one of the fields. The select statements are from a syslog database that I have and I would like to highlight key events by changing the colors for that row. Example would be MAJOR, yellow and INFO, green. Does anybody have any examples of how to do this? -- 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