MySQL 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 'AND d.dltype=t.id AND d.category=c.id AND l.id=d.licenseid AND d.r' at line 15

Attempted query:

SELECT d.*, t.downloadtype, c.category as categorydesc, l.license, d.hosted, d.allowreports FROM downloads d, dltypes t, categories c, licenses l WHERE d.id= AND d.dltype=t.id AND d.category=c.id AND l.id=d.licenseid AND d.ready = 1