select * from where product_image != '' and bigcate='1' and smcate='9' and thirdcate='131' and view='Y' order by srlno desc You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where product_image != '' and bigcate='1' and smcate='9' and thirdcate='131' and' at line 1