Hey folks,
So im trying to create my own appointment system for a imaginary medical clinic. I have a join hapeing in the database to return all the appointments that are booked for a specific day, appointments are of course unique per timeslot per day and per doctor.
I have been having trouble spitting this information out though. i get the result ok but im trying to create a select menu with all the times not booked from this the patient chooses a time.
i have a for loop creating all possible timeslots and i wanted to check the values returned by mysql fetch array against the generated time, if they match then move to next time. ONLY NO MATCHING TIMES ARE IN THE SELECT these are available appointments.
Have a look the while loop doesnt help but i cant get the data from mysql any other way,
$taken_slots = mysql_fetch_array($taken);
#this way works but only gives me the first value not the rest in the array.
for ($hour=9;$hour<=16;$hour++){
if($hour<10){
$on_hour="0$hour:00";
if (!in_array($on_hour, $taken_slots)) {
echo "<option value=\"$on_hour\">$on_hour</option>";}
for($turns=1;$turns<=3;$turns++){
$min=$turns*15;
$hr_mins="0$hour:$min";
if (!in_array($hr_mins, $taken_slots)){
echo "<option value=\"$hr_mins\">$hr_mins</option>";}
}
}
else{
$on_hour="$hour:00";
if (!in_array($on_hour, $taken_slots)) {
echo "<option value=\"$on_hour\">$on_hour</option>";}
for($turns=1;$turns<=3;$turns++){
$min=$turns*15;
$hr_mins="$hour:$min";
if (!in_array($hr_mins, $taken_slots)){
echo "<option value=\"$hr_mins\">$hr_mins</option>";}
}
}
}