Buongiorno, sto eseguendo la seguente query:
Codice PHP:
$sql = "SELECT * FROM eventi WHERE id='$id'";
$result = $conn->query($sql);
echo"<table class='table mdl-data-table' id='example'>
<thead>
<tr>
<th class='text-center font-bold dark-grey-text'>id</th>
<th class='text-center font-bold dark-grey-text'>Nome Corso</th>
<th class='text-center font-bold dark-grey-text'>Stato</th>
</tr>
</thead><tbody>
";
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$nome = $row["corso"];
$stato = $row["stato"];
$id = $row["stato"];
echo "<tr style='background-color:#F7F7F7'><td class='text-center'>$id</td><td class='text-center'>$nome</td><td class='text-center'>$stato</td>”;
}
}
else {
echo "…..";
}
$conn->close();
?>
</tr>
</tbody></table>
la variabile id ha 2 valori 9 e 13.
Ottengo questa impaginazione
id |
Nome Corso |
Stato |
9 |
Posturale |
prenotato |
9 |
Posturale |
prenotato |
9 |
Posturale |
prenotato |
13 |
Sala |
prenotato |
Invece vorrei ottenere questa id |
Nome Corso |
Stato |
9 |
Posturale |
prenotato |
9 |
Posturale |
prenotato |
9 |
Posturale |
prenotato |
|
|
|
id |
Nome Corso |
Stato |
13 |
Sala |
prenotato |
Come devo modificare la mia query?