search

//creation of the index:
//this means that when searching the string will be looked for in the the 3 fields specified within the brakets.

ALTER TABLE fulltext_sample ADD FULLTEXT(username,first_name,last_name)

//searching:
//this searches any word where $mystring is contained (that's why the *) in the 3 cols
SELECT * FROM fulltext_sample WHERE MATCH(username,first_name,last_name) AGAINST('*".$mystring."*' IN BOOLEAN MODE);

source

Leave a Reply