Hi All
Hope you can help me please. I am new to PHP arrays.
I have some data from a MySQL database table that I need to extract into a specific order within an array. The data will be graphed. The graphing is not the problem but making sure the data is in the right order is.
Data Table:
[FONT="Courier New"]
Product ID Date Value
1 01/01/08 10
2 01/01/08 20
3 02/01/08 30
4 02/01/08 40
5 03/01/08 50
6 04/01/08 60
[/FONT]
This is what we know
I know there are 4 unique dates (01/01/08, 02/01/08, 03/01/08, 04/01/08). The graph will have 4 bars representing the dates.
If there is no value for the date I have to provide a zero.
The array has to be provided in the following way:
[FONT="Courier New"]
01/01/08 10, 0, 0, 0
01/01/08 20, 0, 0, 0
02/01/08 0, 30, 0, 0
02/01/08 0, 40, 0, 0
03/01/08 0, 0, 50, 0
04/01/08 0, 0, 0, 60
[/FONT]
Can anyone help please?
Thanks in advance.
Berb