SQL error: 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 'order by topic_id desc limit 1' at line 1\b

Original query: select topic_id, topic_name from forum_data where status='1' and (city='Sydney' or city is null) and category_id = '' and topic_id < order by topic_id desc limit 1