Skip to content
Advertisement

How can i group data from mysql database into an html table using php

I have two table s that i am joining together as follows

JavaScript

Results are as follows enter image description here

But The results am looking for should display as follows

enter image description here

How can i achieve this?

Advertisement

Answer

This code “remembers” the previous name in your loop. If the name isn’t changed it won’t be displayed:

JavaScript

Note: You should add ORDER BY in your query in order to sort your result in a proper way (maybe it’s already sorted)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement