php - Codeigniter generic model functions -
i still wondering why codeigniter don't provide generic functions model can usefull creating reading update deleting joining , other manipulation of records provide facility user , save time of developer have read grocery crud not looking have created 2 3 function can phone call generic functions retrieving , updating. here functions are.
get_recordsreturns multiple records
function get_records($table, $where=null) { if(!empty($where)) { $this->db->where($where); } $query=$this->db->get($table); if($query->num_rows>0) { homecoming $query->result(); } else { homecoming array(); }
get_record() return single record
function get_record($table, $where=null) { if(!empty($where)) { $this->db->where($where); } $query=$this->db->get($table); if($query->num_rows>0) { homecoming $query->row(); } else { homecoming 0; } }
update()
general purpose function updation
function update($table ,$where=null ,$data) { if(!empty($where)) { $this->db->where($where); } $query=$this->db->update($table,$data); if($query) { homecoming $this->db->affected_rows(); } }
delete()
//general purpose function deletion
function delete($table , $where=null) { if(!empty($where)) { $this->db->where($where); } if($this->db->delete($table)) { homecoming $this->db->affected_rows(); } }
here general function there alot more codeigniter model because there alot of functions can created generic functions
my question body have derived kind of stuff if yes provide me link have been looking generic functions codeigniter model because if more time saving rather writing 1 our own
but in www body created generic functions codeigniter model?
i not active in codeigniter community anymore 1 used in past here
https://github.com/jamierumbelow/codeigniter-base-model
if looking inject orm codeigniter, perhaps may want @ quick tutorial:
http://jamieonsoftware.com/post/90299647695/using-eloquent-orm-inside-codeigniter-with-added-query
php codeigniter model
No comments:
Post a Comment