Hey! I'm working on the search script for my site, and I'm have some trouble with the results... I can't seem to find a good way of shortening the description below the page title.

Right now, it shows the entire content

I want it to return something like:

Page
---------------------------------
a 200 word excerpt from the row['content']
---------------------------------

Maybe have it return like 100 words on either side of the match:

Page
---------------------------------
100 words, matched term, 100words
---------------------------------

PHP Code:
// Print a caption:
echo '<h2>Search Results</h2>';

// Display the search results if the form
// has been submitted.
if (isset($_GET['terms']) && ($_GET['terms'] != 'Search...') ) {

// Query the database.
require_once('includes/mysql_connect.php');

$query "SELECT * FROM content";
$result = @mysql_query($query);

//Fetch the results.
while($row = @mysql_fetch_array($result)) {

if(
eregi($terms$row['title'])) {
$searchresults[] = $row['id'];
} elseif(
eregi($terms$row['content'])) {
$searchresults[] = $row['id'];
}
}

//Print the results:
if (isset($searchresults)) {

echo 
'<table class="form_table">';

foreach (
$searchresults as $searchr => $searchresults) {

require_once(
'includes/mysql_connect.php');

$query "SELECT title, content, last_update FROM content WHERE id='$searchresults'";
$result = @mysql_query($query);
$row = @mysql_fetch_array($result);

$trimmed_content eregi($terms$row['content']

echo 
'
<tr valign="top"><td class="form_td_head">'
.$row['title'].'</td></tr>
<tr valign="top"><td class="form_td_cont">'
.$row['content'].'</td></tr>
<tr valign="top"><td class="form_td_foot">Last Update:'
.$row['last_update'].'</td></tr>
'
;

}

echo 
'</table>';
}


} else { 
// Tell them to use the search form.
echo '<p class="bad_message">Please use the search form at the top of the window to search this site.</p>';