Articles → PHP CODEIGNITER → Active Records In Codeigniter
Active Records In Codeigniter
Purpose
Example
<?php
class mymodel extends CI_Model
{
public function GetUsers()
{
$this
->load
->database();
$q = $this
->db
->get_where("Class", array(
'classCode' => 'LKG'
));
$result = $q->result();
return $result;
}
}
Click to Enlarge
Advantages Of Active Record
- Less code writing.
- Database independent.
- Safe against SQL injection.