I'm trying to pull the information in MySql and show in php, with a filter in the room name
$reserva = mysqli_query($connect, 'select * from reserva join curso on reserva.idCurso = curso.idCurso join professor on reserva.idProfessor = professor.idProfessor join sala on reserva.idSala = sala.idSala;');
$reservaArray = mysqli_fetch_array($reserva);
$selectSala = mysqli_query($connect, 'SELECT * FROM sala') or die('Deu erro');
while($teste = mysqli_fetch_array($selectSala)){
$arraySala[] = $teste['nomeSala'];
}
for ($sala=9; $sala<=20; $sala++){
echo '<tr>
<th scope="row">'.$arraySala[$sala].'</th>
<td colspan="3" class="text-center">';
if($arraySala[$sala] == $reservaArray['nomeSala']){
echo $reservaArray['idCurso'].' - '.$reservaArray['nomeCurso'].' - '.$reservaArray['nomeProfessor'];
}
echo'</td>
</tr>';
}
There are 3 records, but only the first one is shown. I already tried using while
but could not execute