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 'AND p.activ=1 ORDER BY p.pret_discount, p.pret desc, p.id DESC LIMIT 10' at line 1SELECT p.*,p.nume_ro as nume, p.descriere_ro as descriere, pc.id_categorie, c.parinte FROM produse p left join produse_categorii pc ON p.id=pc.id_produs left join categorii c ON c.id=pc.id_categorie WHERE p.id<> AND p.activ=1 ORDER BY p.pret_discount, p.pret desc, p.id DESC LIMIT 10