I have Queen View Hotel in the business_name column and I search for Queen Hotel the result will be no match found, when search for Queen View Hotel it will return value…below is the code am running…
$bquery = "(SELECT business_name
, business_title
, business_description
,company_logo
, email_add FROM business WHERE
business_name LIKE :business_name
OR business_title LIKE :business_title
OR business_description LIKE :business_description)";
$s = $pdo->prepare($bquery);
$placeholders[':business_name'] = '%' . $keyword . '%';
$placeholders[':business_title'] = '%' . $keyword . '%';
$placeholders[':business_description'] = '%' . $keyword . '%';
$s->execute($placeholders);
I want it to return value Queen View Hotel when Queen Hotel or Queen or Hotel is enter in the search box.
@John_Betong I was unable to find the answer from the source file there…pls kindly help me with code sample relating to the code I post to solve the problem
@Mittineague pls kindly help with written php code to take care of the space with wildcard…back on the project now and I need to solve this now, not getting it yet…thanks.
@Mittineague I dont understand it…pls help with the code I posted with the php code on how I can replace the space with wildcard…when I enter Queen the result should include Queen View Hotel…
If on the off-chance that does not work then please zip and send me a partial copy of your “business” table with the following fields: business_name, business_title and business_description. On receipt of the zip file I will create an online demo,
Edit:
No doubt there are better ways to create the SQL statement that contains an unllimited number of partial space separated words. If anyone can supply an alternative solution I would be very grateful.
if ( ($extreme_mode_chkd) && (is_array($variants_arr)) ) {
for ($i = 0; $i < count($variants_arr); $i++) {
if ($cities_chkd) {
$search_query .= " OR (`cities`.`phoneme` LIKE :variant_phoneme_" . $i . " OR `cities`.`transliteration_phoneme` LIKE :variant_phoneme_" . $i . " OR `cities`.`transliteration` LIKE :variant_name_" . $i . " OR `cities`.`name` LIKE :variant_name_" . $i . ")";
}