hi guys im new here and new to php
i have this search code in my website that returns the matching search searches.
my problem is the script is shit!
if the title i am looking for is "Captain America"
and i search "captain america" it returns with no issue,
but if my title is "Captain.America"
then i get no results.
i figured i need to tell the script to take these characters in the title "_-." and look at them as spaces.
here is the code i got
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('t.fid = '.(int) substr($search, 3));
} else {
$search = $db->Quote('%'.$db->getEscaped($search, true).'%');
$query->where('( t.name LIKE '.$search.' )');
}
}
return $query;
could somebody explain as to what i should do please
been racking my brain for hours on this
i was coming up with ideas like this
$search = $this->getState('filter.search');
$search2 = str_replace(' ', '.', $search);
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('t.fid = '.(int) substr($search, 3));
} else {
$search = $db->Quote('%'.$db->getEscaped($search, true).'%');
$search2 = $db->Quote('%'.$db->getEscaped($search2, true).'%');
$query->where('( t.name LIKE '.$search.$search2.' )');
}
}
return $query;
but this just gave errors