Re: Re: Exporting Data From MySQL Using PHP

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

 



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