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 '-36, 36' 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 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 (60,61,62,63,101,107,103,102,112,113,104,106,116,117,123,124,122,91,119,114,141,115,118,43,152,44,153,45,37,46,47,49,50,48,35) and prodcat_weight.hidden='0' and products.lang='Greek' group by products.id order by prodcat_weight.weight ASC, id desc LIMIT -36, 36