Re: Change styling depending on var value
| From: | Ashley Sheridan | Date: | Fri, 20 Nov 2009 20:16:55 +0000 |
| Subject: | Re: Change styling depending on var value | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299982@lists.php.net to get a copy of this message | ||
On Fri, 2009-11-20 at 15:11 -0500, Phil Matt wrote:
> Ashley Sheridan wrote:
>
> > Well, you're main problem here is that you are only using a single =
> > character. What that is saying to PHP is: "if you let me assign the
> > value of $beverage to $row[3] then do this next bit", but what I think
> > you wanted it to say was "if $row[3] is the same as $beverage then do
> > this next bit", which would need == instead of =
> >
>
> Thanks, Ashley. I don't do enough PHP to get used to the syntax.
>
> I changed the operators to ==, but my conditional apparently isn't
> working correctly. I checked to make sure the values in the cells were
> the strings as I've specified them, but the resultant formatting always
> defaults to the ELSE color.
>
> Must be something very simple, but I'm just not getting it.
>
> Cheers --- Phil
Don't forget to reply to all!
Just a quick question, what do you get if you do:
print $row[3];
Does it contain a string like you expect?
Thanks,
Ash
http://www.ashleysheridan.co.uk