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 'S%' order by rand() limit 6' at line 1 select * from tbl_product where cat_id= '9' and status=1 and name_1 like '%MEN'S%' order by rand() limit 6