Link to home
Start Free TrialLog in
Avatar of BHUC
BHUCFlag for United States of America

asked on

Format table with mysql data using php

I have an sql database and need to get output as a table. I have done this before but always gone horizontally with data. This time I need to go vertically:

Output would look like:

Category     Jan-14    Feb-14   Mar-14   Apr-14 (through months entered for current year)   Average
Cat 1             98.7           95.5       87.7        98.8                                                                                    95.18              
Cat 2             89.5           97.5       90.25      95.2                                                                                    93.11
Cat 3             98.7           95.5       87.7        98.8                                                                                    95.18  
Cat 4             89.5           97.5       90.25      95.2                                                                                    93.11  

Looking for some reading to learn how to do this loop (vertically) and do the average based on the months entered.

Database fields are:
ID
Month
Year
Cat 1
Cat 2
Cat 3
Cat 4
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BHUC

ASKER

Thanks Ray, I will dive into this tonight when I can concentrate!