I have a datetime field in the sql table, but because I have to first generate hourly ratings for a channel, I had to select data for only one date, and one hour at a time, Because the hourly share needs to have all the viewer ids, I had to group by tvstations and couldn't (or didn't know how to) merge all that information into one query, even using subqueries. So I ended up finding the share for a station for each hour properly, but only for a specific (single) date.
I think I would take your advice on storing the results in the table (somewhere, I would now have to revise the schema) and try to incoporate that new table in running the query for multiple days.
But I would still like to know are arrays created in a volatile manner 'in' the php page... ? meaning that if I store something in an array and then refresh the page, would it overwrite it, or is there anyway to make the array static?