* Thus wrote msa ([EMAIL PROTECTED]): > > $query_rsENews = 'SELECT * FROM NewsArchive WHERE YEAR(datePublished) = ' . > YEAR(NOW()) . ' AND MONTH(datePublished) = ' . MONTH(NOW()) . ' ORDER BY > sortBy DESC'; > > got this error: > Fatal error: Call to undefined function: year() > > any ideas, anyone?
You're mixing php and mysql, you've changed from using php's date() function to mysql's functions. Not to through a whole new twist into all your problems but your query probably should be written differently: $query_rsENews = 'SELECT * FROM NewsArchive WHERE datePublished >= DATE_FORMAT(NOW(), "%Y-%m-01") ORDER BY sortBy DESC'; And add an index on the datePublished column. You'll notice a considerable speed difference. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php