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 'ORDER BY sort_order, IF(LENGTH(`name_ru`), `name_ru`, `name_uk`)' at line 1
SELECT categoryID, IF(LENGTH(`name_ru`), `name_ru`, `name_uk`) as name, products_count, products_count_admin, parent, slug FROM SC_categories WHERE categoryID<>0 AND parent= ORDER BY sort_order, IF(LENGTH(`name_ru`), `name_ru`, `name_uk`)