Search the text inside a variable for a certain term, php
<ol>
<li><p>I am pulling profiles which mention the word "fitness" from a database like so:</p>

<pre><code>$result = mysql_query("SELECT profile FROM ".$table." WHERE profile LIKE ('fitness')");
</code></pre></li>
<li><p>I am doing a basic retrieval of the <code>$profile</code> variable and echo it.</p>

<pre><code>while($slice = mysql_fetch_assoc($result)) {
    $profile = $slice['profile'];
    echo $profile;
}
</code></pre></li>
</ol>

<p>What I'd like is a way to search the text inside <code>$profile</code> for the word "fitness" and highlight the found word using maybe CSS.</p>

<p>Any ideas how?</p>

<p><strong>UPDATE:</strong></p>

<p>Ty very much, and I have one more problem.</p>

<p>In the sql query I will have:</p>

<pre><code>$result = mysql_query("SELECT profile FROM ".$table." WHERE $profile_rule");

$profile_rule = 'profile LIKE ('fitness') AND profile LIKE ('pets')';
</code></pre>

<p>Is there a way to s**trip the $profile_rule** and get just the <strong>words fitness and pets</strong>? Maybe strip everything which isn't encased by '' ?</p>

<p>Ty</p>
