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 '-12, 12' at line 1
1064
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 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 (979,886,901,1005,893,880,877,868,879,894,865,985,1012,898,900,908,1038,878,987,867,986,864,984,892,1039,906,873,887,1033,876,810,863,875,802) and prodcat_weight.hidden='0' group by products.id order by prodcat_weight.weight ASC, id desc LIMIT -12, 12