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 category_id = ORDER BY date DESC LIMIT 0, 1000' at line 1SELECT * FROM albums WHERE album_id <> AND category_id = ORDER BY date DESC LIMIT 0, 1000You 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 type_id = 1 ORDER BY position ASC' at line 1SELECT type_id, file FROM album_media WHERE album_id = AND type_id = 1 ORDER BY position ASC