Re: Re: Exporting Data From MySQL Using PHP
| From: | Peter Ellis | Date: | Tue, 10 Aug 2004 05:44:48 +0000 |
| Subject: | Re: Re: Exporting Data From MySQL Using PHP | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35652@lists.php.net to get a copy of this message | ||
It seems to me that, at least in terms of consistency, using backticks
isn't a bad idea. After all, if you look at any current version of
phpMyAdmin that generates PHP selection code, it uses backticks
constantly. I take your point, but it seems to me like it's a good
habit no matter what. Perhaps that's more a matter of semantics than
PHP programming itself :)
As for the difference between = and LIKE, you are correct -- I just
don't typically use LIKE for any of my database work, so I forget
there's a difference every once in a while :) Thank you for the
reminder.
--
Peter Ellis - pellis@naturalaxis.com
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/
On Tue, 2004-08-10 at 12:33 +0800, Jason Wong wrote:
> On Tuesday 10 August 2004 11:34, Peter Ellis wrote:
>
> > It has been my experience that you sometimes need to do backquotes (`)
> > in MySQL queries when cutting/pasting into PHP -- it's the same key as
> > the tilde (~) on my keyboard. Try:
> >
> > $result = mysql_query("SELECT e_mail FROM subscriptionsdatabase WHERE
> >
discipleship_mailing_list_e_mail_subscription LIKE 'on'");
>
> The backticks (`) are only needed if:
>
> (a) your column names uses (MySQL) reserved words (eg names of the builtin
> functions etc)
>
> (b) you have spaces in your column names
>
> Both (a) and (b) are rather bad and shouldn't really be used. Just use
> 'friendly' column names and backticks will not be necessary.
>
> > That should work. I've always used the equal sign instead of LIKE, but
> > that seems to be a matter of preference.
>
> It is not a matter of preference, = and LIKE have different purposes. Refer to
> manual and/or some SQL tutorial for details.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-db
> ------------------------------------------
> /*
> Why won't you let me kiss you goodnight? Is it something I said?
> -- Tom Ryan
> */