Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Format table with mysql data using php

Avatar of BHUC
BHUCFlag for United States of America asked on
2 Comments1 Solution146 ViewsLast Modified:
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:
Cat 1
Cat 2
Cat 3
Cat 4