php - Best way to save orders in array by date -


my database is: table: orders, columns: id (int), order_status(varchar), time (timestamp), price (decimal);

i want receive sum of orders prices each day in 1 array. best way that?

i've used this, lasts 24h, 48h, 72h... orders , not each day (from 00:00 until 23:59).

$timeback = time() - 86400; $time = time(); $month = array();  for($i = 0; $i < 30; $i++){ //query example $month[$i] = select orders `order_status` = 'completed' , `time` between {$timeback} , {$time} order `id` asc"); $timeback = $timeback - 86400; $time = $time - 86400; } 


Comments

Post a Comment

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -