[eluser]michalo[/eluser]
Hi, I have array with SQL query results saved as cache file. I would like take only one row from this result and show it in my view. However, If I do that i receive error: Call to a member function offsetGet() on a non-object! What I am doing wrong? If I take all rows everything is ok.
Controller function:
Code:
public function searchajax()
{
$offset=$this->uri->segment(3, 0);
$id=$this->uri->segment(4, 0);
$pom=$this->cache->get($id);
$iterator = $pom->getIterator();
$iterator->seek($id);
$data['wynik']=$pom;
$data['id']=$id;
$data['offset']=$offset+1;
$this->load->view('ajax2', $data);
}
View part:
Code:
<?php foreach($wynik as $row): ?>
..
<?php
echo $row->adres;
echo $row->miasto;
?>
...
<?php endforeach;?>