msa wrote:
My date format is as above....I am getting the following error message:

You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near 'Y') . ' AND
MONTH(date) = ' . date('m') . ' ORDER BY sort DESC'


I changed your code to fit my table name and "sort" to be lower case, as it is in the database:

"SELECT * FROM NewsArchive WHERE YEAR(date) = ' . date('Y') . ' AND
MONTH(date) =' . date('m') . ' ORDER BY sort DESC";

any ideas?

thanks again!!


date('m') was not parsed by php as it was in the string. Syntax highlighting would help you see it. Try:


"SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . "' AND
 MONTH(date) ='" . date('m') . "' ORDER BY sort DESC";

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to