This array problem has been stumping my brain for a little while now...
here's a sample of my data:
$purchases[001][200304] = array('regular'=>3, 'booked'=>4);
$purchases[002][200303] = array('regular'=>5, 'booked'=>1);
$purchases[002][200304] = array('regular'=>1, 'booked'=>0);
$purchases[002][200307] = array('regular'=>0, 'booked'=>2);
$purchases[003][200303] = array('regular'=>0, 'booked'=>4);
$purchases[003][200301] = array('regular'=>5, 'booked'=>0);
$purchases[004][200309] = array('regular'=>0, 'booked'=>2);
The first array element of $purchases is a Part Number (or "SKU"). The
second element of $purchases is the month/year for which the assigned data
("regular" and "booked" values) are set.
I need to take this data and place it into a table that has a row for each
part number, and 12 months worth of cells. An example of the desired chart
(apologies to the
non-fixed font viewers!):
SKU| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec
---+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+----
001| | | | 3/4 | | | | | | | |
---+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+----
002| | | 5/1 | 1/0 | | | 0/2 | | | | |
---+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+----
003| 5/0 | | 0/4 | | | | | | | | |
---+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+----
004| | | | | | | | | 0/2 | | |
In this case, the table layout would be 4 rows and 12 cells.
In this sample data's case, there are three rows of Part Number "002". This
needs to be combined into one row. There will only be a maximum of
12 elements for each SKU (there will never be duplicated Month/Year values).
Can anyone lead me in the right direction?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php