Articles → PHP CODEIGNITER → Autoload.PHP In Codeigniter

Autoload.PHP In Codeigniter






Purpose




$this->load->database();







Example






Picture showing setting up database library as autoload in config.php
Click to Enlarge



<?php
class mymodel extends CI_Model
{
    public function GetUsers()
    {
        //$this->load->database(); // Commenting the code
        $q = $this
            ->db
            ->query("select * from Class;");
        $result = $q->result();

        return $result;
    }
}



Output


Picture shows the list of classes from database
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, July 21, 2020

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250