Giter VIP home page Giter VIP logo

commonmodel's Introduction

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

commonmodel's People

Contributors

ah72king avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.