Re: assignment of data into a 2 dimensional array
| From: | John W. Holmes | Date: | Mon, 03 May 2004 18:31:30 +0000 |
| Subject: | Re: assignment of data into a 2 dimensional array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185226@lists.php.net to get a copy of this message | ||
From: "Adam Williams" <awilliam@mdah.state.ms.us>
> Hi, I have a database I am querying the date, and a set of numbers
> associated with each date. For example I may query a range of dates, for
> my exmaple I will use 04-20-2004 with the numbers 4,5,6,5,7,4 and the
> date 4-21-2004 with the numbers 1,2,5,1,2. There really is no pattern
> to the numbers, I'm just using some random numbers and dates. Anyway, I
> need to create a 2 dimensional array, where the 1st dimension contains
> the dates, and the discrete numbers in the 2nd dimension. so for example
> array[0][x] would contain the date of 04-20-2004 with 4,5,6,7 and
> array[1][x] would contain 4-21-2004 and 1,2,5. Then I would need to loop
> through the array and print the dates and the total count of the discrete
> numbers. How would I do the date/number assignment and then handle the
> printing of the dates and numbers from the array? the range of dates and
> numbers is always changing, so I need some sort of loop that can handle an
> ever changing amount of selected dates and numbers. thanks
Can you give an example of where this data is coming from and how its
formatted before you want to reformat it? Is the list and date the result of
a query or do you have the list in a separate variable or array?
$list1 = '2,3,4,5';
$list2 = '6,3,5,6,7';
How do those relate to the dates? Are you running multiple queries? A short
code example would help us a lot here.
---John Holmes...