Hi,
I have followed the excellent tutorial at https://www.chronoengine.com/faqs/72-ccv5/5215-how-do-i-build-a-where-statement-in-ccv5.html to create a complex WHERE statement, limiting results to those having fields that match a search string.
My current code is as follows:
This works fine for exact matches such as ServiceNumber = '157' or Occupation = 'Labourer' but how do I enable MySQL LIKE wildcards so that I can also match Name = 'John' or Name = 'Smith' when the field value of Name is 'John Smith'?
Thanks in Advance.
I have followed the excellent tutorial at https://www.chronoengine.com/faqs/72-ccv5/5215-how-do-i-build-a-where-statement-in-ccv5.html to create a complex WHERE statement, limiting results to those having fields that match a search string.
My current code is as follows:
<?php
// Get search string from url
$search = JRequest::getVar('search');
// Get records matching the search
if ($search <> "") {
$dbo = \GCore\Models\Dossiers::getInstance()->dbo;
$search = $dbo->quote($search);
return array (":
Name LIKE {$search} OR
ServiceNumber = {$search} OR
Occupation LIKE {$search}
");
}
?>
This works fine for exact matches such as ServiceNumber = '157' or Occupation = 'Labourer' but how do I enable MySQL LIKE wildcards so that I can also match Name = 'John' or Name = 'Smith' when the field value of Name is 'John Smith'?
Thanks in Advance.