function showDays() { $day = date('Y-m-d '); //echo date($day,strtotime('-1 day'));; $endday = strtotime("2014-8-1 0:0:0"); $endday = date('Y-m-d', $endday); $i = 1; do { $db = new PictureDB(); $result = $db->selectByDay($i - 1); //print_r($result); $p = new PictureTimeline(); $p->data["picture"] = $result; $dbscrum = new TaskDB(); $tasks = $dbscrum->selectByDay($i - 1); $s = new ScrumTimeline(); $s->alldata = $tasks; $timeline = new Timeline(); $timeline->data["day"] = $day; $timeline->picture = $p; $timeline->scrum = $s; $timeline->showDay(); $day = date('Y-m-d ', strtotime("-{$i} day")); $i++; } while ($day >= $endday); }