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 'and published >= '2011-05-01 00:00:00' and published <= '2011-05-31 23:59:59' or' at line 3SELECT agent_blog_articles.*, agent_blog_categories.title as category from agent_blog_articles JOIN agent_blog_categories on (agent_blog_articles.blog_category_id = agent_blog_categories.blog_category_id) where agent_blog_articles.display = "1" AND agent_blog_articles.site_id = and published >= '2011-05-01 00:00:00' and published <= '2011-05-31 23:59:59' order by published desc limit 1