I have a table in html of turns that is dynamically created with a FOR having as limiting the schedules that the doctors work and I need to create a SELECT in a modal with the available schedules but I can not find the way to compare the schedules that already have shifts (that I get from a query) with those that are generated by the FOR. I thought I would get it with an if and then pass it through a function to jquery and fill in the SELECT with an .html ()
$option = mysql_query("SELECT DATE_FORMAT(turnos.dia,'%H:%i') as dia FROM turnos WHERE dia LIKE '".$strFecha."%' AND medico='".$medID."' ORDER BY dia ");
for ($a=$horaDesde;$a<=$horaHasta;$a++) { /*en que horarios trabajan traidos de una tabla sql*/
foreach ($option as $key => $value) {
if ($value['dia']!==$a.":00") {"<option>".$a.":00</option>";}
if ($value['dia']!==$a.":15") {"<option>".$a.":15</option>";}
if ($value['dia']!==$a.":30") {"<option>".$a.":30</option>";}
if ($value['dia']!==$a.":00") {"<option>".$a.":45</option>";}
}
If I do this, compare each shift schedule with the entire table one by one