$attachment = $DB_site->query_first("SELECT a.userid, u.username, a.filename, a.counter, a.dateline FROM attachment a, user u WHERE a.userid = u.userid AND a.attachmentid = whatever"); $attachment['date'] = vbdate($dateformat, $attachment['dateline']); $attachment['time'] = vbdate($timeformat, $attachment['dateline']);