Estimados, queria pedir ayuda con esto...
necesito hacer una busqueda que se ordene en una tabla, me explico, tengo este codigo el cual me busca todos los datos que necesito
Cita: $query = mysql_query("SELECT medicos.nombre, medicos.apellido, semana.semana, turno.dia, turno.hra, lugar.lugar, medicos.tipo, medicos.especialidad FROM medicos ,semana ,turno ,lugar ,horario WHERE medicos.id_med = horario.id_med AND semana.id_semana = horario.id_semana AND
turno.id_turno = horario.id_turno AND lugar.id_lugar = horario.id_lugar");
print '<table>
<tr>
<th>Nombre</th>
<th>Lugar</th>
<th>dia</th>
<th>Hora</th>
</tr>';
while ($row = mysql_fetch_assoc($query)){
print '<tr>
<td>'.$row['nombre'].' '.$row['apellido'].'</td>
<td>'.$row['lugar'].'</td>
<td>'.$row['dia'].'</td>
<td>'.$row['hra'].'</td>
</tr>';
}
print '</table>';
Resultado:
Código HTML:
<table>
<tr>
<th >Nombre</th>
<th >Lugar</th>
<th>Dia</th>
<th>Horario</th>
</tr>
<tr>
<th >Hernan</th>
<th >Sala 4</th>
<th> Lunes</th>
<th>8:30-10:30</th>
</tr>
<tr>
<th >Hernan</th>
<th >Sala 1</th>
<th> Lunes</th>
<th>10:30-13:30</th>
</tr>
<tr>
<th >Dr Farias</th>
<th >Licencia</th>
<th> Viernes</th>
<th>13:30-17:00</th>
</tr>
<tr>
<th >Soledad</th>
<th >Sala 3 </th>
<th> Lunes</th>
<th>13:30-17:00</th>
</tr>
</table>
ahora necesito que la busqueda se separe en tablas que contega un horario especifico, que cuando arroje todos los datos se separen segun dia y hora, ejemplo:
Cita: <table>
<tr>
<th >Nombre</th>
<th >8:30-10:30</th>
<th>10:30-13:30</th>
<th>13:30-17:00</th>
</tr>
Dia "Lunes"
|Nombre | 8:30-10:30 | 10:30-13:30 | 13:30-17:00 |
|Hernan | Sala 4 | Sala 1 |
Soledad | - -- ----- | ----------- | Sala 3
Dia "Viernes"
|Nombre |8:30-10:30 |10:30-13:30 | 13:30-17:00
|Dr Farias | ---------- | ------------- | Licencia
ojala se entienda. Gracias