Re: problems in WHERE statment
| From: | Daniel Brown | Date: | Wed, 23 May 2007 17:30:08 +0000 |
| Subject: | Re: problems in WHERE statment | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255447@lists.php.net to get a copy of this message | ||
On 5/23/07, Greg Donald <gdonald@gmail.com> wrote:
On 5/21/07, Mike Ryan <miker@mail.manti.com> wrote:
I am a newbie so please bear with me.
I get this error message when I try to run a query
Connected successfullyCould not successfully run query () from DB:
Unknown
column '$today' in 'where clause'
this is the query command
$query = 'SELECT *
FROM job listing
WHERE open >=$today
'$today' not $today
--
Greg Donald
http://destiney.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
You're also single-quoting your SQL query. When including a variable in
there, you should double-quote around the query string, and single-quote the
values you're seeking.
Example:
$query = "SELECT * FROM job listing WHERE open >= '$today' LIMIT 0,30";
It looks like your PHP code was generated by phpMyAdmin.... I know it
outputs data like you supplied. Also, as a postscript, you should try not
to use table names that include a space. If at all possible, convert `job
listing to job_listing` with an underscore.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107