I'mtryingtoimplementablockschedulingsystemwheretheuserchoosesthedateandlocationoftheirchoice.Afterthat,hewillchoosethetimesaccordingtoavailabilityandneedtoblockschedulesthatareunavailable.Itriedtosearchthedatabaseandcreateanarrayofallpossibleschedulingtimestocomparewiththeresultsobtained,butIbelieveIamwithsomelogicerror,becausethemysqli_fetch_arrayfunctiondoesnotreturnallvaluesandstartsanewonesearchwhenitfallsintheconditionofif()thatIput.Exemplifying:
Thescheduleshavebeenscheduledfrom6:00p.m.,7:00p.m.and8:00p.m.on05/28/2018intheblockwhoseid=1.
Withthecodebelow,itreturnsme3integercolumnswiththespecifiedarrays,beingthatinthefirstcolumnonlyappearstheunavailablethetimeof18h00,inthesecondcolumnonly19h00andinthethirdcolumnonly20h00asunavailable.>
Anyideatoadjustandbringmejustonecolumnwiththethreetimesunavailable?Manythanksfromnow
$consulta_sql="SELECT hora_agendada FROM tabela_agendamentos WHERE data='$data_escolhida_pelo_usuario' AND id_quadra_escolhida_pelo_usuario='1'";
$query = mysqli_query($infos_conexao, $consulta_sql)
while ($dados_do_mysql = mysqli_fetch_array($query)){
foreach ( array("9:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00") as $hora_array ) {
if($hora_array == $dados_do_mysql['hora']){
$hora_array ='Horário Indisponível';
}
echo $hora_array;
}
}