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