仅显示今天的Sum()

时间:2019-04-27 00:28:29

标签: php mysqli

我只需要显示今天的总金额。明天只为明天等等。这是我的代码:

<div class="num" data-postfix="" data-duration="1500" data-delay="0">

<?php
    include ("db_connection.php");

    $sql=mysqli_query($mysqli,"SELECT SUM(deposit_amount - deposit_charge) 
    AS 'deposit_today' 
    FROM incomes 
    WHERE date_time >= DATE_SUB(NOW(), INTERVAL 1 DAY)");

    while($arow=mysqli_fetch_array($sql)){
    ?>

    <p> <?php echo $arow['deposit_today']; ?> </p>

    <?php 
    }
    ?>
</div>

但是在所有日期中仅显示SUM(deposit_amount - deposit_charge)

0 个答案:

没有答案