SELECT a.id, a.meta_url, a.pubdate, a.meta_description, a.meta_title FROM articles a INNER JOIN articles_thematiques at ON at.idGroup_article = a.idGroup WHERE a.LCID=1036 AND a.visible=1 AND at.idGroup_theme = AND (a.pubdateend='0000-00-00 00:00:00' OR a.pubdateend<=NOW()) ORDER BY a.pubdate DESC, a.id DESC
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 (a.pubdateend='0000-00-00 00:00:00' OR a.pubdateend<=NOW()) ORDER BY a.pub' at line 4