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 '-20,20' at line 1 : select * from properties where 1 and prop_status='Active' and (prop_type_auto_id='62' or prop_type_auto_id='91' or prop_type_auto_id='81' or prop_type_auto_id='98' or prop_type_auto_id='74' or prop_type_auto_id='72' or prop_type_auto_id='70' or prop_type_auto_id='68' or prop_type_auto_id='67' or prop_type_auto_id='66' or prop_type_auto_id='64' or prop_type_auto_id='65') order by prop_auto_id desc limit -20,20