1064 - 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.articles_date_available IS NULL or to_days(a.articles_date_available) <= ' at line 1

SELECT a.articles_id,a.articles_img, ad.articles_name,ad.articles_description,date_format(a.articles_date_added,'%b %d %Y') date from articles a, articles_to_topics a2t, topics t, topics_description td, articles_description ad where a2t.topics_id = td.topics_id and t.topics_id = td.topics_id and t.topics_type = and (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and t.topics_id = and ad.language_id = '1' and td.language_id = '1' ORDER BY RAND() LIMIT 15