计算PHP当前月份的MySQL行数

I want to display the number of orders of current month and I don't know the query to do it:

This is the code:

$stats_orders_curr = mysql_query(
                     'SELECT count(1) FROM orders 
                      WHERE MONTH = MONTH(CURDATE()) 
                      AND YEAR = YEAR(CURDATE())'
);

$orders_curr =  mysql_fetch_array($stats_orders_curr);
$orderscurr = $orders_curr[0];

I would change the SQL from

SELECT count(1) FROM orders WHERE MONTH = MONTH(CURDATE()) AND YEAR = YEAR(CURDATE())

To

SELECT count(*) FROM `orders` WHERE MONTH(`orderdate`) = MONTH(CURDATE()) AND YEAR(`orderdate`) = YEAR(CURDATE())

Where orderdate is the field that records the date of the order ;)

Try this:

SELECT * FROM `orders` WHERE `orderdate` >=  DATE_FORMAT(NOW(), '%Y-%m-01 00:00:00')

It's good practice to avoid functions on fields something like

where MONTH(orderdate)

because you will loose using of indexes.