Codeigniter Models Intro

Codeigniter Models Intro : Codeigniter Models are specifically used to interact with database. In Short Model is PHP Class which is used for database operations like insert, Update and Delete etc…

Codeigniter models are placed in “application/models” folder.

Codeigniter Models Example

defined('BASEPATH') OR exit('No direct script access allowed');

class My_model extends CI_Model {
 function __construct()
   public function getData(){

     $query = this->db->get('users',10);
     return $query->result();



The Above example shoes a simple method to get 10 rows from the table “users”.


Add Comment

📖 Read More