Select * FROM pages pa WHERE page_site_id = 39 AND (Left(pa.page_cat_id,0) = '' AND pa.page_active = 1 AND pa.page_show_on_parent = 1 AND pa.page_id <> AND LENGTH(pa.page_cat_id) < '1') Order By pa.page_priority Asc

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 LENGTH(pa.page_cat_id) < '1') Order By pa.page_priority Asc' at line 1