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

[eluser]umefarooq[/eluser]
hi omrion here is simple CRUD for you and whole CI Community.

Simple CRUD

here how to use it

1. first call crud library controller's constructor or any specific function of controller.
Code:
$this->load->library('crud');

2. here is insert,update and delete using library

in insert you have to pass table name and array of data to insert.
Code:
$data = array('name'=>$name,'description'=>$desc);
$this->crud->setRecord('test',$data);

in update record you have to pass table name, array of data and selector of specific data
Code:
$this->crud->updateRecord('test',$data,array('id'=>$id));

in delete record you have pass table name and selector of specific data
Code:
$this->crud->deleteRecord('test',array('id'=>$id));

to get specific record, it will return you only one row by passing table name and selector.
Code:
$row = $this->crud->getRecord('test',array('id'=>$id));

to get all rows just pass table name,
Code:
$data['rows'] = $this->crud->getRecords('test');

and when using pagination pass record per page and page number to the getRecords function as
Code:
$data['rows'] = $this->crud->getRecords('test',20,1);

to get the count of all rows pass only table name
Code:
$this->crud->getCount('test');

to get last inserted id
Code:
$this->crud->getLastID('test');


this CRUD library is generic library no need to code models again and again you can modify library according to your need. please report me bugs and updates about this library.


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