Posted By

valcartei on 07/11/07


Tagged

search fulltext indexing


Versions (?)

search


 / Published in: SQL
 

  1. //creation of the INDEX:
  2. //this means that when searching the string will be looked FOR IN the the 3 FIELDS specified within the brakets.
  3.  
  4. ALTER TABLE fulltext_sample ADD FULLTEXT(username,first_name,last_name)
  5.  
  6. //searching:
  7. //this searches any word WHERE $mystring IS contained (that's why the *) in the 3 cols
  8. SELECT * FROM fulltext_sample WHERE MATCH(username,first_name,last_name) AGAINST('*".$mystring."*' IN BOOLEAN MODE);

Report this snippet  

You need to login to post a comment.