class Users extends Model{
function Users(){
// call the Model constructor
parent::Model();
// load database class and connect to MySQL
$this->load->database();
}
function getAllUsers(){
$query=$this->db->get('users');
if($query->num_rows()>0){
// return result set as an associative array
return $query->result_array();
}
}
function getUsersWhere($field,$param){
$this->db->where($field,$param);
$query=$this->db->get('users');
// return result set as an associative array
return $query->result_array();
}
// get 5 rows at a time
function getUsers($row){
$query=$this->db->get('users',5,$row);
if($query->num_rows()>0){
// return result set as an associative array
return $query->result_array();
}
}
// get total number of users
function getNumUsers(){
return $this->db->count_all('users');
}
}
Reference
1 comment:
not good man, try more in this transaction.
Post a Comment