PDA

View Full Version : php/mysql: select items for month



Johnsie
May 26th, 2010, 01:21 PM
In the mysql 'dateOrdered' field the dates are dd/mm/yyyy (i didnt create the table)

I'm trying to select the accountsQuantity for everything that was ordered in April but the following query wont work:


SELECT accountsQuantity FROM customer_envelope_orders_psort WHERE company='$company' AND dateOrdered BETWEEN '01/04/2010' AND '30/04/2010'


Anyone know how I can do this?

januzi
May 26th, 2010, 02:08 PM
Could You add something like:


echo $query.' '.mysql_error() ;

after the line with mysql_query( $query ) ?

DaithiF
May 26th, 2010, 03:29 PM
Hi,
use:

between '20100401' and '20100430'