SELECT * FROM images WHERE owner_id= AND type='leads' AND img_type='leads'

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 type='leads' AND img_type='leads'' at line 1