[eluser]InterMedio[/eluser]
[quote author="Hamed" date="1337673495"]This my class and I get error on $dep = $deps->result(); while I use auto load of database and I use sth like this code in Controller.
Code:
class Content extends CI_Model {
function Function_model()
{
parent::Model();
}
function getDate($date) {
}
function getDep($did) {
$deps = $this->db->query("SELECT * FROM `dep` WHERE did='$did'");
$dep = $deps->result();
return $dep->title;
}
}
Error:
Quote:A PHP ERROR WAS ENCOUNTERED
Severity: Notice
Message: Trying To Get Property Of Non-Object
Filename: Models/Content.Php
Line Number: 20
[/quote]
In this return $dep->title; line you are have problem.
Just return $deps->result(); in this method.
Any element of this array you can get in view or controller.