Welcome Guest, Not a member yet? Register   Sign In
One problem with PHP 5.4.7
#1

[eluser]sarbaz[/eluser]
Hi
One problem with PHP 5.4.7


Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: row

Filename: core/Loader.php(829) : eval()'d code

Line Number: 6


Code:
A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: core/Loader.php(829) : eval()'d code

Line Number: 6


Code:
<?php
  foreach ($test as $i) {
   echo ($i);
  }
?>

What could be the reason for the error?????
#2

[eluser]hungryhippo[/eluser]
Can you post the code from your controller and view?
#3

[eluser]sarbaz[/eluser]
Controller
Code:
public function index(){
       $data['article'] = $this->model_article->IndexArticleList();
         $this->_out('contain',$data);

}

View
Code:
<? foreach($article as $row):?>
<div class="ContainTitle"><a href="&lt;?=base_url();?&gt;site/summary/&lt;?=$row-&gt;id?&gt;">&lt;?=$row->title?&gt;</a></div>
        <div class="article">
         &lt;?=$row->summary?&gt;
        </div>
        <div>/div>
&lt;? endforeach ?&gt;

Model
Code:
public function IndexArticleList(){
$count = $this->uri->segment(3);
          $this->db->order_by("id", "desc");
          $this->db->limit(5,$count);
          $this->db->where('archive','0');
$data = $this->db->get('nik_article');
return $data->result();
}




Theme © iAndrew 2016 - Forum software by © MyBB