Re: mysql case statement
| From: | David McGlone | Date: | Mon, 28 Jun 2010 15:47:02 +0000 |
| Subject: | Re: mysql case statement | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-306487@lists.php.net to get a copy of this message | ||
On Monday 28 June 2010 11:14:53 Andrew Ballard wrote:
> On Mon, Jun 28, 2010 at 10:27 AM, David McGlone <david@dmcentral.net> wrote:
> > Tanel, we both learned something. I didn't fully understand join myself
> > yet, but I think I do now.
> >
> > but let me ask this if the join wasn't there would an if statement like I
> > mentioned have worked?
> >
> > Blessings,
> > David M.
>
> I think you are confusing a few things. You can't really rely on
> testing "empty(DB_HIDDENPANELS)" because the value of the constant
> DB_HIDDENPANELS is most likely a string that was set with an earlier
> call to define. The OP could have tested for the column value
> "hiddenpanel" using an if (...) test as you suggeted. However, given
> that the OP stated he "would like to select hiddenpanel only if there
> is a corresponding value in DB_HIDDENPANELS," the INNER JOIN will do
> that at the database query level, so an if (...) then test in PHP
> isn't really necessary.
That is exactly what I was wondering. I haven't got to joins yet, and didn't
understand them at all until Richard explained a few minutes ago.
I knew my suggestion was a complete shot in the dark and I did feel stupid
posting it, but I'm glad now, because I learned something invaluable.
Thanks to this list, someday, which I hope is sooner than later, I'll be able
to help somebody with complete confidence.
--
Blessings,
David M.