You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-24, 24' at line 1
query=SELECT products.*, min(products_atts.price) as pricefrom, min(products_atts.pricex) as pricexfrom, count(products_atts.product_id) as attcount, products_images.filename as thefile from prodcat_weight inner join products on products.prod_id=prodcat_weight.prod_id inner join suppliers on suppliers.sid=products.supplier left join products_atts on products.id=products_atts.product_id left join products_images on products.prod_id=products_images.prod_id and products_images.firstimg=1 WHERE prodcat_weight.cat_id in (383,384,480,374,361,357,358,359,342,442,360,386,375,369,476,343,350,474,481,469,470,356,471,472,473,346,483,387) and prodcat_weight.hidden='0' and suppliers.supplier_url='ell' group by products.id order by prodcat_weight.weight ASC, id desc LIMIT -24, 24