Best search technique for mysql using php

I have around 7 text boxes of which 3 are mandatory , I have one search table, I want to know what is the best logic to achieve the optimum search results.

-------------Problems Reply------------

i recommend using full text search, it will search all the fields and ignore them if null, here is a decent guide on it and i would add filters that make it more than 2 characters and ignore an array of common words e.g put your search in a if statement like this

$ignorewords = array("the","and","their","there" ,"to","fix","make","add","then","if", "for", "then","or");

if ( (in_array(strtolower($value), $ignorewords) == false) && (strlen($value) > 2 ) )

use like "%{$value}%" to get things containing words or parts of words. the if statement checks if the search term ($value) is in the array, and if its not it will return false, the >2 restriction is to prevent someone typing "a" and getting everything with the letter a in back.

Category:php Views:1 Time:2017-09-13
Tags: php mysql

Related post

Copyright (C), All Rights Reserved.

processed in 0.068 (s). 10 q(s)