如何在php中回显所有5天计数值?

kg7wmglp  于 2021-06-24  发布在  Mysql
关注(0)|答案(1)|浏览(265)
SELECT dateofbooking, count(id) AS total FROM participant WHERE dateofbooking >= $datepick AND 
  dateofbooking <= DATE_ADD($datepick, INTERVAL 5 DAY)GROUP BY dateofbooking;

如何在php中回显所有5天计数值?

bihw5rsg

bihw5rsg1#

使用此代码

$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;

相关问题