Re: problems in WHERE statment

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

 



Change the single quote to a double quote:

<code>
$query = "SELECT * FROM `job listing` WHERE open >= '$today' LIMIT 0 , 30
";
</code>

This tells the PHP string parser to replace all declared, in-scope variables
that are detected in a string with the value of the variable (as a
toString() method, so a reference would not pass in the actual data, it
would print something like "Resource id #3").

When you use single-quotes, you are telling the parser to keep it's hands
off the string, and use "as-is".

Example:
<code>
var $a = 'test';
var $b = 'test2';
var $c = '$a$b';
var $d = "$a$b";
var $e = $a.$b;
</code>

$e is equivalent to $d, where c would print literally $a$b, since you told
the parser using the single quotes to leave the string alone.

Likewise, var $f = $a."-$b$c-".'$e'; would print test-test2$a$b-$e;

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

[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