I'm a noob with PHP arrays, so i could really use some assistance on this fairly simple issue.
I'm making a stats page for IT techs that uses support ticket and phone data to produce performance stats. The problem is that i need to pull multiple queries grouped by technician, and still be able to show the data with techs on rows and results in columns. This example is simplified, so the full version takes ALOT longer due to 15 queries per tech and over 30 techs.
Example
Tech | Opened | Closed | Backlog
Name1 | 20 | 10 | 30
Name2 | 25 | 12 | 30
Name3 | 21 | 16 | 30
Name4 | 10 | 12 | 30
Current Method
The current method runs an individual query for each cell. There is a query for each column, that uses the name of the tech to pull only the count for that tech. It loops through a list of techs.
Query Agents : pulls the list of technicians names
Query Opened:
Query Closed:
Query Backlog:
For each agent, the opened, closed, backlog queries are run. This takes WAY too long.
Proposed Method
I have modified the queries to "Group by" tech instead of "where tech =". This way i can run 3 queries that each contain all techs stats.
The loop would once again loop through all techs but would print the results from the correct row of the queries. Now I encounter 2 problems.
1. The techs are not in the same order in the different queries.
2. A tech may be in one query but not another (ie opened but did not close any tickets)
I guess what i would like to know how to do is, save the query results to an array where the tech's name is the array row pointer.
I.E. Opened(techname) returns the result of the Opened query where the agent is techname.
Any suggestions?