Invalid query: SELECT * FROM goods WHERE param4='' and param2='' and param3='' AND goodstype= AND quantity>0 AND documentid!=1005013 ORDER BY price1 LIMIT 6: 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 quantity>0 AND documentid!=1005013 ORDER BY price1 LIMIT 6' at line 1