Hi everyone so my problem is 90% like this one: How to make search results "clickable"
(please read it). But the only difference is that in the best solution, the str_replace is case sensitive, i tried to replace it with str_ireplace, but the problem was that the word becomes bold but lowercase in the same time. Thanks for help!
code:
if(isset($_POST['tosearchfor']))
{
$query = $db->query('SELECT * FROM searchfor WHERE title LIKE \'%'.$_POST['tosearchfor'].'%\'');
for($i=0; $i<20; $i++)
{
if($result = $query->fetch())
{
$result = str_ireplace($_POST['tosearchfor'], '<b>'.$_POST['tosearchfor'].'</b>', $result);
echo '<div class="result">
<a class="title" href="#">'.$result['title'].'</a>
<span class="link">
<span style="font-size:15px;position:relative;top:0.8px;padding-right:2px;">‣</span>
https://www.qsoft.com/'.$result['link'].'
</span>
<span class="details">'.$result['details'].'</span>
</div>';
}
else
{
if($i==0)
{
echo 'Sorry, no resluts found for : <strong>'.$_POST['tosearchfor'].'</strong>';
}
}
}
}