I'm doing similar but I don't need attachments - I only use inline images (i.e. Img bb code).
If this is enough I can let you see my code.
If this is not enough and you really need genuine attachments to show, I suggest you have a look at viewtopic.php and look at the code around:
Code: Select all
parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);