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