ERROR IN QUERY: 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 nodeid !=1195 order by rand() limit 4' at line 1 SELECT nodeid, title, price FROM catalog WHERE parentid= and nodeid !=1195 order by rand() limit 4