$getthreadid=$DB_site->query_first("SELECT threadid FROM post WHERE attachmentid=".intval($attachmentid)); $threadid=$getthreadid['threadid'];