循环编辑时$ i = 0

I think this is fairly simple, just not a php coder. Researching and reading posts I narrowed down my issue to this piece of code, but not sure how to edit. Things found and tried throw error.

The following code works fine and gives me the results for the current date (today) and previous 6 days. I want to try and change so rather than obtaining the past I want to show the future events. So today and next 6 days.

$i=0;
while ($i<=6){
    $labeldate=date('m/d',mktime(0,0,0,$sm,$sd-$i,$sy));
    $_SESSION['statistic_week'] = date('Y-m-d',mktime(0,0,0,$sm,$sd-$i,$sy));

    $statistic = querySQL('statistic_week_def');
    foreach ($statistic as $row) {
        $statistic_week_def[$i] = ($row->paxsum) ? $row->paxsum : 0; 
    }
    $labels[] = $labeldate;

$i++;
}
查看全部
douqian5553
douqian5553
2014/02/05 08:23
  • while-loop
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复