Post this error for lilserf: [SELECT * FROM character_bios WHERE character_id= AND draft=0 AND episode_id <= 320 AND draft=0 ORDER BY episode_id desc;] . 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 draft=0 AND episode_id <= 320 AND draft=0 ORDER BY episode_id desc' at line 1