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 &nbsp;</td>
            </tr>';
     
     
     }// end while




HTH

Peter



-----Original Message-----
From: Christopher Lyon [mailto:[EMAIL PROTECTED]
Sent: 17 June 2003 22:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] 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

Reply via email to