Ошибка в SQL
SELECT id,title,url,link FROM main WHERE (active<>0 AND inmenu = 1 AND pid=) ORDER BY tree
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 ') ORDER BY tree' at line 3