I sugest to search using regular expresions in state of 'LIKE', this is an example of how i'm doing this:
PHP Code:
if(strpos($field, "phone") === false)
{
$clause .= "LIKE '{$_REQUEST['query_string']}%'";
}
else
{
$temp_str = $_REQUEST['query_string'];
$temp_str = ereg_replace( '[^0-9]+', '', $temp_str );
$temp_clause = '"';
for($i=0;$i < strlen($temp_str)-1; $i++)
{
$temp_clause .= $temp_str[$i] . "[- ./]?";
}
$temp_clause .= $temp_str[$i];
$temp_clause .= '*"';
$clause .="REGEXP " . $temp_clause;
}
this will return a more accurate result.
In the way the search is implemented in your fix if you have this numbers: 314 233 6540 and 314 323 36540 in the database and if you search for 314 233 6540 then the both number will be returned as result.
Bookmarks