Skip to content

AH72KING/CommonModel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Common Model

All Credit goes to Syed Haider Hassan #pakistanihaider @pakistanihaider

PHP Framework Codeigniter Common Model This Model is developed to use CodeIgniter CRUD functions to remove repetition and increase productivity as well as DRY ( Don't Repeat YourSelf ) Approach .

If you are fade up with use of this DB

$this->DB...

Use Common Model once . you will never do this->db again. Common Model is easy to use and can be extended.

How To Use

Add the Common_model.php in model folder and add this line in your base controller or where you like to access DB best option is to add it into auto load.

$this->load->model("Common_model");

Select

$this->Common_model->select('Table_Name_Here');

this will give you object array of all fields of that table

Select Fields

$this->Common_model->select_fields('Table_Name_Here', 'Name, Age');

for full parameters of select_fields function see common model file select_fields($tbl = '', $data, $single = FALSE,$group_by = '',$order_by = '',$resultArray = false)

Select Fields Where

$this->Common_model->select_fields_where('Table_Name_Here' ,'Name, Age' ,'Age > 24');

for full parameters of select_fields_where function see common model file select_fields_where($tbl = '', $data, $where, $single = FALSE, $like = '', $field = '', $value = '',$group_by = '',$order_by = '',$array = false)

Insert Record

$this->Common_model->insert_record($tbl, $data);

Update

$this->Common_model->update($tbl, $where, $data)

Delete

$this->Common_model->delete($table , $where=NULL)

There is alot more in file Explore it you will love it

About

PHP Framework Codeigniter Common Model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages