title: PHP - CodeIgniter - Invalid argument supplied for foreach()?
body: <p>I try to write a site with CodeIgniter but I've a problem with PHP. I'm sure that it's so simple and can't be wrong. But I don't know bugs from , just a newbie of CodeIgniter :)</p>
  
  <pre><code>&lt;div class="row-fluid"&gt;
      &lt;div class="span12"&gt;
  
          &lt;div class="box"&gt;
                &lt;div class="title"&gt;
                   &lt;h4 class="clearfix"&gt;
                      &lt;span class="left"&gt;&lt;?php echo $title;?&gt;&lt;/span&gt;
                  &lt;/h4&gt;
              &lt;/div&gt;
            &lt;div class="content"&gt;
  
              &lt;form action="&lt;?php echo current_url();?&gt;" method="post"&gt;
  
                &lt;div class="span2"&gt;  
                  &lt;select name="month"&gt;
                    &lt;?php foreach($options['months'] as $montht){
                    ?&gt;
                      &lt;option value="&lt;?php echo $montht['month'];?&gt;"&gt;&lt;?php echo turkcetarih('F','2013-'.$montht['month'].'-01');?&gt;&lt;/option&gt; 
                    &lt;?php
                    }
                    ?&gt;
  
                  &lt;/select&gt;
                &lt;/div&gt;
  
                &lt;div class="span2"&gt;
                  &lt;select name="year"&gt;
                    &lt;?php foreach($options['years'] as $yeart){
                    ?&gt;
                    &lt;option value="&lt;?php echo $yeart['year'];?&gt;"&gt;&lt;?php echo $yeart['year'];?&gt;&lt;/option&gt;
                    &lt;?php
                    }
                    ?&gt; 
                  &lt;/select&gt;
                &lt;/div&gt;
  
                &lt;div class="span3"&gt;
                  &lt;button type="submit" class="btn btn-primary"&gt;Göster&lt;/button&gt;
                &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
          &lt;?php if($charts):?&gt;
          &lt;div class="box"&gt;
  
              &lt;div class="title"&gt;
                   &lt;h4 class="clearfix"&gt;
  
                      &lt;span class="left"&gt;&lt;?php echo turkcetarih('F Y',$year.'-'.$month.'-01');?&gt; Site Dökümü&lt;/span&gt;
                  &lt;/h4&gt;
              &lt;/div&gt;
              &lt;div class="content noPad"&gt;
  
                  &lt;table class="responsive table table-bordered"&gt;
                      &lt;thead&gt;
                        &lt;tr&gt;
                          &lt;th&gt;Tarih&lt;/td&gt;
                          &lt;th&gt;İzlenme&lt;/td&gt;
                          &lt;th&gt;Yeni Üye&lt;/th&gt;
                          &lt;th&gt;Eklenen İçerik&lt;/th&gt;
                          &lt;th&gt;Yeni Yorum&lt;/th&gt;
                        &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tbody&gt;
                      &lt;?php 
                      for($i=0;$i&lt;count($charts['day']);$i++)
                       {
  
                      ?&gt;
  
                        &lt;tr&gt;
                              &lt;td&gt;&lt;?php echo turkcetarih('d F Y',$charts['year'][$i].'-'.$charts['month'][$i].'-'.$charts['day'][$i]);?&gt;&lt;/td&gt;
                              &lt;td&gt;&lt;?php echo $charts['hit'][$i];?&gt;&lt;/td&gt;
                              &lt;td&gt;&lt;?php echo $charts['user'][$i];?&gt;&lt;/td&gt;
                              &lt;td&gt;&lt;?php echo $charts['video'][$i];?&gt;&lt;/td&gt;
                              &lt;td&gt;&lt;?php echo $charts['comment'][$i];?&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;?php 
                        }
                        ?&gt;
  
                      &lt;/tbody&gt;
                  &lt;/table&gt;
  
              &lt;/div&gt;
  
          &lt;/div&gt;&lt;!-- End .box --&gt;
          &lt;?php else:?&gt;
              &lt;div class="well"&gt; &lt;p&gt; &lt;strong&gt;&lt;?php echo turkcetarih('F Y',$year.'-'.$month.'-01');?&gt;&lt;/strong&gt; için grafik dökümü bulunmamaktadır.&lt;/p&gt;&lt;/div&gt;
          &lt;?php endif;?&gt;
  
      &lt;/div&gt;&lt;!-- End .span12 --&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I've a bug from this file :</p>
  
  <blockquote>
    <p>A PHP Error was encountered Severity: Warning Message: Invalid
    argument supplied for foreach() Filename: admin/dashboard_charts.php
    Line Number: 28</p>
  </blockquote>
  
  <p>Sorry for my English :)</p>