PHP Classes


Recommend this page to a friend!

      Database Search  >  All threads  >  Hi.  >  (Un) Subscribe thread alerts  
Summary:Package rating comment
Author:Alexander Farennikov
Date:2009-07-24 01:23:41

Alexander Farennikov rated this package as follows:

Utility: Insufficient
Consistency: Not sure
Documentation: Not sure
Examples: Not sure

  1. Hi.   Reply   Report abuse  
Alexander Farennikov - 2009-07-24 01:23:41
Hi. Because in building search query with logic "OR" you start it with "1 OR CONCAT(...) ...", it returns ALL rows from the table. I modified your example as follows:
$arr = array();
foreach ($text as $word) $arr[] = "CONCAT($concat) LIKE '%$word%'";
$srch = implode (" {$this->logic} ", $arr);
$sql = "SELECT DISTINCT id FROM $table WHERE $srch ORDER BY id DESC";

This query returns only relevant results.