Harlequin try this for the loop.
PHP Code:
$tags = $DB_site->query ( "SELECT * FROM TABLE_NAME_HERE " ) ;
while ( $tag = $DB_site->fetch_array ( $tags ) ) :
$message = eregi_replace ( $tag['tags'], $tag['tagsname'], $message ) ;
endwhile ;
You just have to edit TABLE_NAME_HERE with the table name that you're selecting the tag data from, hope that helps.
Cheers,
g-force2k2