I'm dealing with a table that is formed from an array and I do not give with the solution, I would greatly appreciate if you could horientar me. The problem is that I can not put in the same row and on the corresponding day the schools that have the same time. Thank you very much
this is the table I want to get:
and this is the code I have:
$Caja = "select Grupos.Nombre,Grupos.Dia_activ1,Grupos.Hora_ini1,Grupos.Hora_fin1,group_concat(Profesores.Color) from Grupos inner join Profesores on (Grupos.profe1 = Profesores.id) where Grupos.Zona='".$cp."' group by Grupos.Nombre order by Grupos.Hora_ini1,Grupos.Dia_activ1 ASC";
$table = mysqli_query($con, $Caja);
$arr = array();
while($row22 = mysqli_fetch_row($table))
{
$row22['Grupos.Nombre'] = explode(",", $row22['Grupos.Nombre']);
$arr[] = $row22;
$numRows22++;
}
$ultimo=0;
$p=0;
foreach($arr as $row){
$horas=$row[2].' a '.$row[3];
if($horas<>$ultimo){
$ultimo=$horas;
$colorprofe=$row[4];
echo "<tr>";
echo "<td>" . $horas ."</td>";
for($w=1; $w<6; $w++){
if($row[1]==$w){
echo " <td>
<button style='background: #".$row[4]."' class='btn btn-default' data-toggle='modal'>" . $row[5] . "</button></td>";
}else{echo "<td></td>";}
}
}else{
echo "<td></td>";
for($w=1; $w<6; $w++){
if($row[1]==$w){
echo " <td>
<button style='background: #".$row[4]."' class='btn btn-default' data-toggle='modal'>" . $row[5] . "</button></td>";
}else{echo "<td></td>";}
}
}
}