[eluser]Ducky[/eluser]
Hi,
After exploring CI for a while i decided to start using models in my applications.
So i created a simple model function to return the results as an object.
Everything works fine if there are results found.
I already check the query for results in the model
Code:
if ($query->num_rows() > 0)
{
return $query->row();
}
else
{
return FALSE;
}
this is how i get the results in the controller
Code:
$data['query'] = $this->Users_model->get_picture($timestamp);
$this->load->view('overview',$data);
This the code on the view page
Code:
<?=$query->picture;?>
the error i receive is(Only when there aren't records to display):
Code:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: views/bargain.php
Line Number: 3
I understand i have to check in the "view" if the object exists but i don't find the solution to do this.
It would be great if someone could tell me the best way to achieve this.
Thanks in advance!
Ducky