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 placement_id='10' AND show_always='1' AND is_active='1'' at line 1==SELECT id, banner_id, width, height, filename, zindex, link, in_new, is_flash FROM ads WHERE page_id= AND placement_id='10' AND show_always='1' AND is_active='1'