Dynamic Variables
Posted: Wed Mar 11, 2009 1:48 am
Hi there,
Suppose I have a database full of pictures, each of which has a date taken associated. Suppose then I want to generate a listing of the number of pictures that were taken in each year, but want it to be dynamic insofar as I want it to return listings for every year that there are pictures from, without knowing ahead of time how many years there actually are.
How can I do this? I figure that I need to have some variables created on the fly, to represent each year, containing a value equal to the number of pictures for that year (this part, the number of pictures in a year, I've already figured out in the context of where this all needs to take place: a big while loop).
Thanks! If anyone needs code snippets or the like, I can provide them, but I figure this shouldn't be so difficult to figure out from my description alone (though I obviously confess to not being able to cipher it out myself.
)
Suppose I have a database full of pictures, each of which has a date taken associated. Suppose then I want to generate a listing of the number of pictures that were taken in each year, but want it to be dynamic insofar as I want it to return listings for every year that there are pictures from, without knowing ahead of time how many years there actually are.
How can I do this? I figure that I need to have some variables created on the fly, to represent each year, containing a value equal to the number of pictures for that year (this part, the number of pictures in a year, I've already figured out in the context of where this all needs to take place: a big while loop).
Thanks! If anyone needs code snippets or the like, I can provide them, but I figure this shouldn't be so difficult to figure out from my description alone (though I obviously confess to not being able to cipher it out myself.