MySQL Fulltext Search with PHP
2 min readJun 14, 2020
Use Case
You have a MySQL database with one ore more columns of type TEXT containing arbitrary free text. You have many rows and a lot of text in each column and you experience very poor performance when using LIKE statements to perform a full text search:
Using LIKE statement
A faster way to perform a full text search is the MATCH AGAINST statement:
Using MATCH AGAINST statement
PHP bind_param
Note the “‘\“” that is wrapped around the search phrase. This is important to make sure you are searching for that exact phrase and not the individual words it contains.
For MATCH AGAINST to perform well you need to create a full text index on the column you want to search: