Change styling depending on var value

From: Date: Fri, 20 Nov 2009 19:45:28 +0000
Subject: Change styling depending on var value
Groups: php.general 
Request: Send a blank email to php-general+get-299979@lists.php.net to get a copy of this message
I am trying to style HTML table cells depending on the values stored in a MySQL db. Thanks to other on this list, I can now refer to the variable that holds a CSS styling value. Now, I need to apply different values of that variable, depending on the content of the table cell itself. I tried something like this, where $row[3] contains string values: $entree ="meat"; $dessert ="ice cream"; $beverage="coffee"; (then the query that returns the data) if ($row[3] = $entree) { $rowcolor = "color:red"; elseif ($row[3] = $dessert) { $rowcolor = "color:blue"; elseif ($row[3] = $beverage) { $rowcolor = "color:green"; } else { $rowcolor ="color:black"; } I think I'm not properly expressing that I want the values in the $row[3] compared to those in the specified vars Thanks again.

« previous php.general (#299979) next »