rendered paste bodywhile ($row = $db->sql_fetchrow($result)){ $message_parser->message = &$row['post_text']; $regexp = '/\<div class=\"quote\"\>.*Quoting: ([^&]*)<\/div>([^&]*)<\/div>/i'; $times = 0; $times = preg_match_all($regexp, $message_parser->message, $matches); if($times > 0){ echo '<p> ' . $row['post_id'] . ' has ' . $times . ' match(es). </p>'; } $inctimes = $inctimes + $times; preg_replace($regexp,"[quote=\"$1\"]$2[/quote]",$message_parser->message); //Update DB with change if there was one if($times > 0){ $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_text = ' . $db->sql_escape($message_parser->message) . ' WHERE post_id = ' . $row['post_id']; $db->sql_query($sql); }}echo '<p> There should be ' . $inctimes . ' modifications to the database </p>';