Codeigniter MY_Model /

Filename Size Date modified Message
15.4 KB
5.2 KB
1.2 KB
35.1 KB


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 (

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


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(){

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! :-)