[nycphp-talk] Multidimensional Arrays?
Gabriel PREDA
radical at amr.ro
Thu Jul 8 09:30:22 EDT 2004
You could try to leave this to MySQL (or whatever SQL server you have):
SELECT team, SUM(year1), SUM(year2), SUM(year3)
FROM `tablename`
[WHERE where_conditions_if_any ]
GROU BY team
[ORDER BY order_clauses_if_any ]
If you can give me a detailed description of the table(s) I can write the
query corectly.
Gabriel PREDA
www.amr.ro
----- Original Message -----
From: "harvey" <list at harveyk.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Wednesday, July 07, 2004 8:14 PM
Subject: [nycphp-talk] Multidimensional Arrays?
> Hello,
> I have code that loops through the database and outputs something like the
> following:
> TEAM 1
> Year 1 Year 2 Year 3
> 8 9 22
>
> TEAM 2
> Year 1 Year 2 Year 3
> 18 94 12
>
> TEAM 3
> Year 1 Year 2 Year 3
> 23 44 45
>
> ALL TEAMS
> Year 1 Year 2 Year 3
> ?? ?? ??
>
> I can't figure out how to easily get the ?? totals. I think I want a major
> array of three minor arrays (I probably just invented my own vocabulary):
> the major array would increment by one each year; the three minor arrays
> would hold the Year 1 values, Year 2 values, and Year 3 values.
> Conceptually, it would be something like $all_teams[$year_id][ ]. Is
> something like that possible? I know that php allows multidimensional
> arrays, but I guess I don't know the proper syntax or usage.
> Thanks in advance for any help!
> Harvey
More information about the talk
mailing list