I have a list of students and a common button Appointment Schedule.
When i click the button set the time schedule for each student is inserted int db
Now i set start time as 9 am .
schedule appointment for all students in that table with 20 min time gap.
controller
function appointment_schedule()
{
$filtered_students = $this->home_model->getFilterStudents();
$fil_std_count=$filtered_students->num_rows();
$filtered_student_ids = $this->home_model->getFilterStudentsIds();
$total_time=$fil_std_count*20;
if($total_time<=240)
{
$st_time = strtotime("09:00 am");
for($i=0;$i<$fil_std_count;$i++)
{
$end_time = date("H:i:s a", strtotime('+20 minutes', $st_time));
$filtered_students = $this->home_model->insert_appointment_schedule(date("H:i:s a", ($st_time)),$end_time,$filtered_student_ids[$i]->applicant_id);
$st_time = strtotime($end_time);
}
}
if($total_time>240 && $total_time <= 360)
{
$st_time = strtotime("02:00 pm");
for($i=13;$i<$fil_std_count;$i++)
{
$end_time = date("H:i:s a", strtotime('+20 minutes', $st_time));
$filtered_students = $this->home_model->insert_appointment_schedule(date("H:i:s a", ($st_time)), $end_time,$filtered_student_ids[$i]->applicant_id);
$st_time = strtotime($end_time);
}
}
redirect(base_url().'home/get_filtered_students','refresh');
}
But I wonder if that's wrong?