I'm trying to make a list where the format goes as follows:
CLUB
- name
- name
- name
CLUB 2
- name
- name
So far, I've managed to autogenerate tables but for each name it displays the name of the club above, even if it's the same club as another one above it. I've tried to do it through mysqli, I don't know if it would be better through PHP. Here's my query so far:
$sql = "SELECT DISTINCT soc.nombre, soc.apellido, club.nombreClub FROM socios as soc
INNER JOIN club4h as club
ON soc.nombreClub = club.nombreClub";
$result =NULL;
foreach($conn->query($sql) as $row){
$club[] = $row["nombreClub"];
$nombreSoc[] = $row["nombre"];
$apellidoSoc[] = $row["apellido"];
}
And here's how it's looking with that query: