Codeigniter MY_Model /

Filename Size Date modified Message
15.0 KB
5.1 KB
1.2 KB
34.3 KB

MY_Model

A simple Codeigniter MY_Model library with CRUD automation, created by me (Nicola Amatucci) and developed also with the help of Isidoro Mercogliano. It's used in project Mercucci (http://www.mercucci.it/).

Function names are in Italian. I'll plan to translate in English in the future. Let's the code talk himself :-)

EXAMPLE

Imagine you have a table named "user_table" with three fields: "id", "name", "password". The model will be:

class User_model extends MY_Model {
    var $name;
    var $password;

    public function construct(){
        parent::construct('user_table');
    }
}

Where $id is declared in MY_Model and is nedeed for CRUD. Hopefully "id" will be an "autoincrement primary key" field in the database.

You can fill the fields of a user_table instance and insert into database using "$instance->inserisci()" ("inserisci" stands for "insert").

Examine MY_Model.php code to learn about other easying function. For example you can create a new object filled with $_POST fields using

function newFromPost()

or fill an existing object with $_POST fields

function fillFromPost()

Have fun! :-)

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.