Welcome Guest, Not a member yet? Register   Sign In
Database autoloading?
#1

[eluser]igul222[/eluser]
Hello everyone.

One of the models in an app I'm making looks something like this:
Code:
class My_model extends Model {

    function My_model() {
        parent::Model();
    }
    
    function delete($id) {
        $this->db->delete('mytable', array('id' => $id));
    }


What I don't understand is... it works. From what I've read on the documentation, you need to call:
Code:
$this->load->database();
before performing any database operations with CI.

My autoload.php does not auto-load the database, so why is this happening?
#2

[eluser]Jelmer[/eluser]
It only needs to be loaded once, so if you loaded it in the controller or a library loaded before this it would work...




Theme © iAndrew 2016 - Forum software by © MyBB