PHP: Bold lastname in autosuggest too
<pre><code>    $queryString = mysql_real_escape_string($_POST['queryString']);
list($firstname, $lastname) = array_map('ucfirst', explode(' ', $queryString, 2));
$query = mysql_query("SELECT users.firstname, users.lastname, users.id 
FROM users INNER JOIN users_friends ON users.id=users_friends.uID
WHERE bID=$USER AND type = '$type' AND (users.firstname LIKE '%$queryString%' OR users.lastname LIKE '%$queryString%') 
LIMIT 10;
");
while ($result = mysql_fetch_object($query)) {
$re_fname='&lt;b&gt;'.$firstname.'&lt;/b&gt;'; 
$re_lname='&lt;b&gt;'.$lastname.'&lt;/b&gt;';
$final_fname = str_ireplace($firstname, $re_fname, $result-&gt;firstname);
$final_lname = str_ireplace($lastname, $re_lname, $result-&gt;lastname);
             echo $final_fname. ' ';
             echo $final_lname.' ';
}
</code></pre>

<p>This is my code for the searching part in my autosuggest dropdown..</p>

<p>I want what youve searched get bold text. Example if you type "Meg" then the "Meg" in Megan, is bold. </p>

<p>This does it fine without any problems. But the lastname doesn't work. </p>

<p>When I type "Fo" or "Fox" or "F",(Megan Fox) it doesn't get bold in the lastname. Why doesn't this work, and how can i fix this? Is it because $lastname is the text after the space, but I even tried "Megan F" or the full "Megan fox" only Megan gets bold, not "Fox".</p>
