SELECT dateofbooking, count(id) AS total FROM participant WHERE dateofbooking >= $datepick AND
dateofbooking <= DATE_ADD($datepick, INTERVAL 5 DAY)GROUP BY dateofbooking;
如何在php中回显所有5天的计数值?
答案 0 :(得分:0)
使用此代码
$from = date('Y-m-d');
$to = date('Y-m-d',strtotime("5 day"));
SELECT dateofbooking, count(id) AS total FROM participant WHERE `dateofbooking` BETWEEN '$from' AND '$to' GROUP BY dateofbooking;