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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to