I
I
Ivan Drozhzhin2017-05-13 13:38:13
PHP
Ivan Drozhzhin, 2017-05-13 13:38:13

How to get the number of orders for today?

The bottom line is, I want to display the total number of orders for today (not for 24 hours) in the admin panel.
I try like this:

$day_orders = $db->query("SELECT COUNT(*) FROM 'oc_order' WHERE 'date_add' >= CURDATE() ");
$day_orders_count = count($day_orders);
echo $day_orders;

Tell me which way to dig? Suggest a bright idea, how to get a variable with the number of orders?
Don't kick too hard, I don't know php well, mysql with google :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2017-05-13
@RotarYMonkeY

$day_orders = $db->query("SELECT COUNT(*) as cnt FROM 'oc_order' WHERE 'date_add' >= CURDATE() ");
echo $day_orders['cnt'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question