.Took out foreach($sched_id AS $sid){.