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 id != 87784' at line 1
select id,classid,title,image_small_url,image_big_url,infotags from ***_ecms_photo_data_handle WHERE infotags_id= AND id != 87784