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 'BY a.date DESC LIMIT 0, 16' at line 1 SQL=SELECT a.*, b.name AS user FROM jos_userwall AS a LEFT JOIN jos_users AS b ON b.id = a.user WHERE a.id > 0 AND a.bgid=446ORDER BY a.date DESC LIMIT 0, 16