Devo eseguire il Rowspan di una tabella dove la cella GIORNO (che contiene un numero del giorno) è grande e a seguire ha du record di due turni diversi notte e giorno
Un esempio tipo questo:
codice HTML:
<table width="200" border="1">
<tbody>
<tr>
<th scope="col">GIORNO</th>
<th scope="col">TURNO</th>
<th scope="col">AUTISTA</th>
</tr>
<tr>
<td rowspan="2">Giovedi 1</td>
<td>giorno</td>
<td>marco</td>
</tr>
<tr>
<td>notte</td>
<td>luca</td>
</tbody>
</table>
Questo è quello che ho creato io
Codice PHP:
<?php
session_start();
include "config.php";
// Create connection
$conn = new mysqli($host_name, $user_name, $password, $database);
// Check connection
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
$mese = $_POST['mese'];
$anno = $_POST['anno'];
echo "Tabella presenze del mese di $mese $anno";
$sql = "SELECT * FROM turnario WHERE mese = '$mese' and anno = '$anno' ORDER BY giorno ASC";
$risultati = $conn->query($sql);
if ($risultati->num_rows > 0) {
echo "<center><table>
<th>Giorno</th>
<th>Turno</th>
<th>Autista</th>
<th>Capopartenza</th>
<th>Vigile</th>
<th>Vigile</th>
<th>Vigile</th>
<th>Vigile</th>
</center>";
// output dei dati
while($row = $risultati->fetch_assoc()) {
echo "<tr>
<td>".$row["giorno"]."</td>
<td>".$row["turno"]."</td>
<td>".$row["autista"]."</td>
<td>".$row["capo"]."</td>
<td>".$row["vigile1"]."</td>
<td>".$row["vigile2"]."</td>
<td>".$row["vigile3"]."</td>
<td>".$row["vigile4"]."</td>
</tr>";
}
echo "</table>";
} else {
echo "<center><font color='CE2B37' font face='ubuntu' font size='6'><Nessun risultato per la ricerca richiesta!></center></font>";
}
$conn->close();
?>