Welcome Guest, Not a member yet? Register   Sign In
CRUD with Ci 1.7
#14

[eluser]Colin Williams[/eluser]
Well, of course it works good. It literally just wraps a handful of database class functions.

Code:
/**
         * $table  database table name required.
         * $num optional using when pagination use
         * $offset optional using when pagination use.
         *
         */
        function getRecords($table,$num = '',$offset = ''){
        
            $query = $this->ci->db->get($table,$num,$offset);
            return $query->result();
        }

        /**
         * $table database table name required
         * $clause array of clauses is required
         */
    
        function getRecord($table,$clause=''){
        
            $query = $this->ci->db->get_where($table,$clause);
            return $query->row();
        }

        /**
         * $table database table name required
         * $data is array of data want to insert required
         */
    
        function setRecord($table,$data){
            $this->ci->db->insert($table,$data);
        }

        /**
         * $table database table name required
         * $data required to update recored
         * $clause array of clauses is required
         */
    
        function updateRecord($table,$data,$clause){
            return $this->ci->db->update($table,$data,$clause);
        }

        /**
         * $table database table name required
         * $clause array of clauses is required
         */
          
        function deleteRecord($table,$clause){
            $this->ci->db->delete($table,$clause);
        }

        /**
         * it will give you last inserted id.
         */
        
        function getLastID(){
            return $this->ci->db->insert_id();
        }

        /**
         * $table name is required to get row counts.
         */
    
        function getCount($table){
            return $this->ci->db->count_all($table);            
        }
        
    }


Messages In This Thread
CRUD with Ci 1.7 - by El Forum - 01-29-2009, 07:35 PM
CRUD with Ci 1.7 - by El Forum - 01-30-2009, 01:15 AM
CRUD with Ci 1.7 - by El Forum - 01-30-2009, 05:21 AM
CRUD with Ci 1.7 - by El Forum - 02-11-2009, 07:56 PM
CRUD with Ci 1.7 - by El Forum - 02-12-2009, 12:35 AM
CRUD with Ci 1.7 - by El Forum - 02-13-2009, 02:15 AM
CRUD with Ci 1.7 - by El Forum - 02-13-2009, 02:55 AM
CRUD with Ci 1.7 - by El Forum - 02-13-2009, 11:32 AM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 04:46 AM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 04:58 AM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 11:27 AM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 12:00 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 12:51 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 12:59 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 01:02 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 01:06 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 01:14 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 01:45 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 02:55 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 02:58 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 03:06 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 03:09 PM
CRUD with Ci 1.7 - by El Forum - 02-14-2009, 04:52 PM
CRUD with Ci 1.7 - by El Forum - 02-24-2009, 08:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB