$couse) { # code... $query = "select * from lesson where course_id = '{$couse["id"]}' limit 0,300"; $fAllLesson = PDO_FetchAll($query); foreach ($fAllLesson as $lesson) { $start = date("Y-m-d\TH:i:s+00:00",$lesson["date"]/1000); $end = date("Y-m-d\TH:i:s+00:00",$lesson["date"]/1000+$lesson["duration"]); $output[]=array("id"=>$lesson["id"], "title"=>$couse["title"], "url"=>"../../course/lesson.php?id=".$lesson["id"], "start"=> $start, "end"=>$end ); } } return($output); } ?>