View Full Version : Mysql like Not showing multiple words result

01-27-2012, 10:21 AM
Below are my script

("SELECT * FROM products s WHERE name LIKE '%" . $queryString . "%' ORDER BY name LIMIT 8");

Example db
Product Name : Cadbury Centre Fill Chocolate Cookies 144g

User type : Centre Cookies cadbury

How can i view the results for multiple words contains

Now there are no result showing

Thanks in Advance

01-27-2012, 10:29 AM
Have a look into the mysql's fulltext search explained at http://devzone.zend.com/26/using-mysql-full-text-searching/ and dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

01-27-2012, 12:41 PM
$queryString = "cadbury";
"SELECT * FROM products WHERE name LIKE '%" . $queryString . "%' ORDER BY name LIMIT 8";

would return you 8 results with cadbury in the name