You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and ile_dok>0 and `on`="1" ORDER BY order_sort, nazwa' at line 1 SQL: SELECT ID_cat, ID_cat_parent, nazwa, nazwa_seo FROM 1_cat WHERE ID_cat_parent= and ile_dok>0 and `on`="1" ORDER BY order_sort, nazwa