Re: Change styling depending on var value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-11-20 at 15:52 -0500, Phil Matt wrote:

> Ashley Sheridan wrote:
> 
> > Copying back the phplist *again*!
> Sorry. I'll remember to copy in...
> > 
> > what does your code currently look like now, with the right == in?
> 
> $entree="meat";
> $beverage="coffee";
> if ($row[3] == $entree)
> {
>     $newcolor="color:red";
> }
> elseif ($row[3] == $beverage)
> {
>     $newcolor="color:red";
> }
> else
> {
>     $newcolor="color:green";
> 
> 
> The result is that all of the text in the styled cell is green.
> 
> <td style="'.$newcolor.'">'.$row[3].'</td>
> 
> I know the script is running through the conditional statement, because 
> if I change the ELSE value of $newcolor, all of the styled cells change 
> to whatever color I specify there.
> 
> I went back and browsed the db table to see to make sure I had the right 
> row and that the entries matched my references - no probs there.
> 
> Cheers --- Phil
> 


copy the results of this:

vardump($row);

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux