PHP数据库 - 通过乘以两个值来输出总收入

Alright so I have a website, paynite.com which uses a PHP script. I'd like to show the total revenue by each user.

So the user's are defined by the ID: usern and this ID exists in the table: Users

REF: http://i.stack.imgur.com/VA9Zl.png

I have products that are sold on my site in the table called: items and I want the row's "sales" and "price_extended" to multiple to form $revenue in the code only when the author ID and the usern matches

Author is defined by the ID: author and this ID exists in the table: items

REF: https://i.gyazo.com/34dc923c79263c1ec7a0918f7741e4ac.png

How can I do this? I've been stuck on this for like 4 hours :( I have very little coding knowledge lmao.

The code I tried to use outputs the total revenue vs sales across the whole site..

<div class="center aligned column dashboard-product-info-box">
    <div class="ui statistic">
        <div class="value dashboard-product-info-value" id="dashboard_product_revenue_value">
            <?php $revenue = 0; $sql = mysql_query("SELECT * FROM sellify_items ORDER BY id"); if(mysql_num_rows($sql)>0) { while($row = mysql_fetch_array($sql)) { $revenue = $row['sales'] * $row['price_extended']; } } echo (number_format($revenue)); ?></div>
<div class="label dashboard-product-info-title">Revenue</div>
    </div>

Help would greatly be appriciated :)