Home:ALL Converter>Php PDO search string as Google or order by best match

Php PDO search string as Google or order by best match

Ask Time:2017-05-09T02:53:06         Author:Saurav Saini

Json Formatter

My pdo query I want best match result

/* Results */
      function getResults(){
      $q=$GLOBALS['q'];
      $p=$GLOBALS['p'];
      $start=($p-1)*10;
      if($q!=null){
      $starttime = microtime(true);
      $sql=$GLOBALS['dbh']->prepare("SELECT 
                                 * FROM `shop` 
                                WHERE `title` LIKE :q 
                                OR `add` LIKE :q 
                                OR `about` LIKE :q 
                                OR `owner` LIKE :q 
                                OR `spe` LIKE :q 
                                OR `cat_nm` LIKE :q 
                                OR `sub_nm` LIKE :q");
      $sql->bindValue(":q", "%$q%");
      $sql->execute();
      $trs=$sql->fetchAll(PDO::FETCH_ASSOC);

My query search only full match text example:

check here

I want search result like as google help me.

Author:Saurav Saini,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43855209/php-pdo-search-string-as-google-or-order-by-best-match
yy