Re: Change styling depending on var value

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

 



To add to what Ashley said about $row[3],  remember that when you are
returning from the db the counter for fields will start at 0 not 1, so if
its the 3rd field that will be $row[2].  You might also want to do switch
rather then elseif but thats always a good debate.

On Fri, Nov 20, 2009 at 3:16 PM, Ashley Sheridan
<ash@xxxxxxxxxxxxxxxxxxxx>wrote:

> 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
>
>
>

[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