select id from offers where now()>=`promo_start` and now()<=`promo_end` and `bought`<=`coupons_available` and parent_id='0' and `status`='1' order by `main_offer` desc,`visits` asc limit 1,-1
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 '-1' at line 1