$contenttypeid = vB_Types::instance()->getContentTypeID('vBForum_Post'); $postid = $newpost['postid']; $attachs = $vbulletin->db->query_read(" SELECT dateline, filename, attachmentid FROM " . TABLE_PREFIX . "attachment WHERE contenttypeid = $contenttypeid AND contentid = $postid ORDER BY attachmentid ");