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 (737,607,545,682,602,621,659,650,649,680,557,601,714,564,570,681,576,574,572,728,678,595,585,676,679,555,584,599,553,550,651,554,591,561,547,725,583,652,715,657,658,654,656,655,738,568,677,735,588,675,674,713,577,578,581,684,580,579,683,597,742,741,697,662,689,647,724,723,644,646,645,718,637,640,712,642,639,641,692,731,695,660,635,694,661,643,720,729,696,673,636,672,623,594,666,603,586,604,589,736,730) and prodcat_weight.hidden='0' group by products.id order by prodcat_weight.weight ASC, id desc LIMIT -12, 12