You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND `language`='en' ORDER BY update_time DESC, id DESC' at line 1query:SELECT `streetartobjectimages`.`id`, filename, title FROM `streetartobjectimages` LEFT JOIN `streetartobjectimagestitles` ON `streetartobjectimages`.`id`=`streetartobjectimagestitles`.`imageid` WHERE streetartobjectid= AND `language`='en' ORDER BY update_time DESC, id DESC