Format rows and colums

Hello,

I have a table like this as below,

Dept - Names

ECE - Mark
ECE - Kris
ECE - Chris
EEE - Ben
EEE - Chris
CSE - Marc
CSE - Math
CSE - Sara

I want to arrange this table as below using php code

ECE EEE CSE


Mark Ben Marc
Kris Chris Math
Chris Sara

how do I achieve this using php code, please help

How are you collecting this data, is it been selected via a database or a static array?

Thsi is been collected from mysql database. I have mentioned it as tableā€¦ any idead?

I want to arrange this table as below using php code

I find your question ambiguous.

Do you mean you have a database table and you want to display the results in a html table?

if so, show us the result of


describe <table>;

replace <table> with the name of your table, paste the results here.