select * from where product_image != '' and bigcate='1' and smcate='12' and thirdcate='96' 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='12' and thirdcate='96' and' at line 1