Quadodo,
you forgot the single quotes:
$type[$r[room_type]]++;
should be:
$type[$r['room_type']]++; :p
that worked perfectly...but i confuse myself....
i have a DB like this
[bookdate] [nights] [room_type]
2006-05-01 3 1
2006-05-02 2 2
2006-05-03 1 3
2006-05-04 5 4
2006-06-01 1 2
2006-06-02 2 4
i want to see how many nights were sold in each roomtype per month.
im using condintionals at the mo:
if ($bd > "2006-05-01" && $bd < "2006-05-31") {
month=may; //condition
}
i need to get:
May Room type 1 nights - 3
May Room type 2 nights - 2
May Room type 3 nights - 1
May Room type 4 nights - 5
June Room type 1 nights - 0
June Room type 2 nights - 1
June Room type 3 nights - 0
June Room type 4 nights - 2
any ideas?