Re: [PHP] problems in WHERE statment
- From: parasane@xxxxxxxxx ("Daniel Brown")
- Date: Wed, 23 May 2007 13:30:08 -0400
On 5/23/07, Greg Donald <gdonald@xxxxxxxxx> wrote:
On 5/21/07, Mike Ryan <miker@xxxxxxxxxxxxxx> 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
- References:
- Re: [PHP] problems in WHERE statment
- From: "Greg Donald"
- Re: [PHP] problems in WHERE statment
- Prev by Date: Re: [PHP] problems in WHERE statment
- Next by Date: Re: problems in WHERE statment
- Previous by thread: Re: [PHP] problems in WHERE statment
- Next by thread: Re: [PHP] problems in WHERE statment
- Index(es):
Relevant Pages
|