Re: Re: Exporting Data From MySQL Using PHP

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

 



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@xxxxxxxxxxxxxxx
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
> */

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux