06-10-2010, 06:25 AM
[eluser]Unknown[/eluser]
Is there a way of accessing the database from a model? Do I have to load something first? Here's a quick example:
class MyModel extends Model {
public function MyModel() {
parent::Model();
}
public function Test() {
var_dump($this->db);
}
}
When I call the Test function, var_dump shows the db object as NULL. I must be doing something wrong. Any help is greatly appreciated. Thanks.
Is there a way of accessing the database from a model? Do I have to load something first? Here's a quick example:
class MyModel extends Model {
public function MyModel() {
parent::Model();
}
public function Test() {
var_dump($this->db);
}
}
When I call the Test function, var_dump shows the db object as NULL. I must be doing something wrong. Any help is greatly appreciated. Thanks.