php - Like function results error -
i have written code users searches in webpage. here sample code going wrong.
$first = true; foreach ($terms $each) { if ($first) { $query .= "keywords '%$each%' "; $first = false; } else { $query .= "or keywords '%$each%' "; } }
here example fails: when user enters "best o" should display words contains "%best% %o%
" in single word going display results contains 2 words there space entered user in between best , o.
it's not searching them in single word. it's searching "best" once , "o" once in words.
Comments
Post a Comment