如何按天明智地在php和sql中获得总销售量

时间:2019-06-18 08:48:56

标签: php mysql sql mysqli

function TodaytotalSell(){
        global $conn;
        $sql = "SELECT SUM(`sell_amount`) as 'TodaytotalSell' FROM `add_sell` WHERE sell_amount = `sell_amount` ORDER BY 'sell_date' LIMIT 1";
            $result = $conn->query($sql);                  
            if(mysqli_num_rows($result) > 0){
            while($fetch = mysqli_fetch_array($result)){                  
            echo "SR ".$fetch['TodaytotalSell']; 
           }
        }
    }

0 个答案:

没有答案