SELECT DISTINCT P.*
FROM prod P
JOIN prod_cat PC ON (P.prod_id = PC.prod_id)
WHERE PC.cat_id IN ('256','14')
AND P.active = 1
AND P.amcnt != 0
AND P.prod_id != 8081790
AND P.file_d0 != 0
ORDER BY , ABS(CAST(P.rank AS SIGNED) - 1) ASC, RAND()
LIMIT 32
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 ' ABS(CAST(P.rank AS SIGNED) - 1) ASC, RAND()
LIMIT 32' at line 9
#0 /home/web/tilga/common/classes/class.db.php(57): db->error('...') #1 /home/web/tilga/common/classes/class.prod.php(379): db->query('...', Array, 8081790, 32) #2 /home/web/tilga/common/classes/class.prod.php(411): prod->get_related_raw(32) #3 /home/web/tilga/ws/pages/prod/item_.php(151): prod->get_related(4) #4 /home/web/tilga/ws/index.php(6): require('...')