Re: problems in WHERE statment

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

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux