Bad query: sql_get_image_data_from_title - SELECT * FROM images as i, album_contents as a WHERE i.img_page_filename LIKE 'keith' AND album_id = AND i.img_id = a.img_id . 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 i.img_id = a.img_id' at line 4