In MY TABLE if I type
floor fly
table returns No matching records
because Global Search php function search records insid
well, you should decide what search criteria you want to use. If you want you use match by certain phrase, and do not want to use FULL TEXT search, you should rebuild your query like:
SELECT * FROM a WHERE a.col1 REGEXP 'text1|text2|text3' OR a.col2 REGEXP 'text1|text2|text3';
In your PHP code, it should be smth like this (you did not specify input data format, so I assume, you are using "$str" as space separated text, and want to check all words in "$str" phrase for search:
if ( $requestColumn['searchable'] == 'true' ) {
$str = str_replace(" ","|",$str);
$binding = self::bind( $bindings, $str, PDO::PARAM_STR );
$globalSearch[] = "".$column['db']." REGEXP ".$binding;
}
This is a bit long for a comment.
For this type of search, you might consider a full text index. The documentation is here. These implement the MATCH . . . AGAINST
functionality.
With such functionality, you can order the results by relevance. This means that you do not have to decide in advance whether the connector is "and" or "or" between multiple words. You can also implement a boolean search, which would allow for more complex complex logic, if you so desire.