Simple CRUD – CodeIgniter
A couple months ago i have developed PHP application. That’s was the first time (and the only one) i used CodeIgniter. The development itself only took a short period, thanks to helpful plugins and libraries such as excel_reader, jpgraph, dompdf and many more. At this moment, i want to share my humble knowledge in creating simple PHP application.
As the title suggest, we are going to create simple CRUD (Create Read Update Delete) application using CodeIgniter framework. The application that we are going to build is not a complex application (that’s why we call it “simple”) but consists of features such as pagination and simple validation.
Here, i’m using CodeIgniter_1.6.3 and MySql 5. Let’s begin.
- Database schema. run this script.
CREATE DATABASE crud; USE crud; CREATE TABLE tbl_person ( id bigint auto_increment PRIMARY KEY, name varchar(50), gender char(1), dob date ); INSERT tbl_person (name,gender,dob) VALUES('henrihnr', 'm', '1985-09-09'); INSERT tbl_person (name,gender,dob) VALUES('name_001', 'm', '1990-01-01'); INSERT tbl_person (name,gender,dob) VALUES('name_002', 'f', '2000-01-01'); INSERT tbl_person (name,gender,dob) VALUES('name_003', 'm', '2000-02-02'); INSERT tbl_person (name,gender,dob) VALUES('name_005', 'f', '2000-04-04');
- Database configuration. file: CodeIgniter\system\application\config\database.php
$active_group = "default"; $active_record = TRUE; $db['default']['hostname'] = "localhost"; $db['default']['username'] = "root"; $db['default']['password'] = ""; $db['default']['database'] = "crud"; $db['default']['dbdriver'] = "mysql";
- Base url configuration. file: CodeIgniter\system\application\config\config.php
$config['base_url'] = "http://127.0.0.1/CodeIgniter/";
- Default controller configuration. file: CodeIgniter\system\application\config\routes.php
$route['default_controller'] = "person";
- Model. create file CodeIgniter\system\application\models\personModel.php. Here we are using active record class.
class PersonModel extends Model { // table name private $tbl_person= 'tbl_person'; function Person(){ parent::Model(); } // get number of persons in database function count_all(){ return $this->db->count_all($this->tbl_person); } // get persons with paging function get_paged_list($limit = 10, $offset = 0){ $this->db->order_by('id','asc'); return $this->db->get($this->tbl_person, $limit, $offset); } // get person by id function get_by_id($id){ $this->db->where('id', $id); return $this->db->get($this->tbl_person); } // add new person function save($person){ $this->db->insert($this->tbl_person, $person); return $this->db->insert_id(); } // update person by id function update($id, $person){ $this->db->where('id', $id); $this->db->update($this->tbl_person, $person); } // delete person by id function delete($id){ $this->db->where('id', $id); $this->db->delete($this->tbl_person); } }
- Controller. create file CodeIgniter\system\application\controllers\person.php
<?php class Person extends Controller { // num of records per page private $limit = 10; function Person(){ parent::Controller(); // load library $this->load->library(array('table','validation')); // load helper $this->load->helper('url'); // load model $this->load->model('personModel','',TRUE); } function index($offset = 0){ // offset $uri_segment = 3; $offset = $this->uri->segment($uri_segment); // load data $persons = $this->personModel->get_paged_list($this->limit, $offset)->result(); // generate pagination $this->load->library('pagination'); $config['base_url'] = site_url('person/index/'); $config['total_rows'] = $this->personModel->count_all(); $config['per_page'] = $this->limit; $config['uri_segment'] = $uri_segment; $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); // generate table data $this->load->library('table'); $this->table->set_empty(" "); $this->table->set_heading('No', 'Name', 'Gender', 'Date of Birth (dd-mm-yyyy)', 'Actions'); $i = 0 + $offset; foreach ($persons as $person){ $this->table->add_row(++$i, $person->name, strtoupper($person->gender)=='M'? 'Male':'Female', date('d-m-Y',strtotime($person->dob)), anchor('person/view/'.$person->id,'view',array('class'=>'view')).' '. anchor('person/update/'.$person->id,'update',array('class'=>'update')).' '. anchor('person/delete/'.$person->id,'delete',array('class'=>'delete','onclick'=>"return confirm('Are you sure want to delete this person?')")) ); } $data['table'] = $this->table->generate(); // load view $this->load->view('personList', $data); } function add(){ // set validation properties $this->_set_fields(); // set common properties $data['title'] = 'Add new person'; $data['message'] = ''; $data['action'] = site_url('person/addPerson'); $data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back')); // load view $this->load->view('personEdit', $data); } function addPerson(){ // set common properties $data['title'] = 'Add new person'; $data['action'] = site_url('person/addPerson'); $data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back')); // set validation properties $this->_set_fields(); $this->_set_rules(); // run validation if ($this->validation->run() == FALSE){ $data['message'] = ''; }else{ // save data $person = array('name' => $this->input->post('name'), 'gender' => $this->input->post('gender'), 'dob' => date('Y-m-d', strtotime($this->input->post('dob')))); $id = $this->personModel->save($person); // set form input name="id" $this->validation->id = $id; // set user message $data['message'] = '<div class="success">add new person success</div>'; } // load view $this->load->view('personEdit', $data); } function view($id){ // set common properties $data['title'] = 'Person Details'; $data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back')); // get person details $data['person'] = $this->personModel->get_by_id($id)->row(); // load view $this->load->view('personView', $data); } function update($id){ // set validation properties $this->_set_fields(); // prefill form values $person = $this->personModel->get_by_id($id)->row(); $this->validation->id = $id; $this->validation->name = $person->name; $_POST['gender'] = strtoupper($person->gender); $this->validation->dob = date('d-m-Y',strtotime($person->dob)); // set common properties $data['title'] = 'Update person'; $data['message'] = ''; $data['action'] = site_url('person/updatePerson'); $data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back')); // load view $this->load->view('personEdit', $data); } function updatePerson(){ // set common properties $data['title'] = 'Update person'; $data['action'] = site_url('person/updatePerson'); $data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back')); // set validation properties $this->_set_fields(); $this->_set_rules(); // run validation if ($this->validation->run() == FALSE){ $data['message'] = ''; }else{ // save data $id = $this->input->post('id'); $person = array('name' => $this->input->post('name'), 'gender' => $this->input->post('gender'), 'dob' => date('Y-m-d', strtotime($this->input->post('dob')))); $this->personModel->update($id,$person); // set user message $data['message'] = '<div class="success">update person success</div>'; } // load view $this->load->view('personEdit', $data); } function delete($id){ // delete person $this->personModel->delete($id); // redirect to person list page redirect('person/index/','refresh'); } // validation fields function _set_fields(){ $fields['id'] = 'id'; $fields['name'] = 'name'; $fields['gender'] = 'gender'; $fields['dob'] = 'dob'; $this->validation->set_fields($fields); } // validation rules function _set_rules(){ $rules['name'] = 'trim|required'; $rules['gender'] = 'trim|required'; $rules['dob'] = 'trim|required|callback_valid_date'; $this->validation->set_rules($rules); $this->validation->set_message('required', '* required'); $this->validation->set_message('isset', '* required'); $this->validation->set_error_delimiters('<p class="error">', '</p>'); } // date_validation callback function valid_date($str) { if(!ereg("^(0[1-9]|1[0-9]|2[0-9]|3[01])-(0[1-9]|1[012])-([0-9]{4})$", $str)) { $this->validation->set_message('valid_date', 'date format is not valid. dd-mm-yyyy'); return false; } else { return true; } } } ?>
- View. create 3 files at CodeIgniter\system\application\views folder. personList.php to list persons with pagination
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>SIMPLE CRUD APPLICATION</title> <link href="<?php echo base_url(); ?>style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="content"> <h1>Simple CRUD Application</h1> <div class="paging"><?php echo $pagination; ?></div> <div class="data"><?php echo $table; ?></div> <br /> <?php echo anchor('person/add/','add new data',array('class'=>'add')); ?> </div> </body> </html>
personEdit.php to add or update a person
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>SIMPLE CRUD APPLICATION</title> <link href="<?php echo base_url(); ?>style/style.css" rel="stylesheet" type="text/css" /> <link href="<?php echo base_url(); ?>style/calendar.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php echo base_url(); ?>script/calendar.js"></script> </head> <body> <div class="content"> <h1><?php echo $title; ?></h1> <?php echo $message; ?> <form method="post" action="<?php echo $action; ?>"> <div class="data"> <table> <tr> <td width="30%">ID</td> <td><input type="text" name="id" disabled="disable" class="text" value="<?php echo $this->validation->id; ?>"/></td> <input type="hidden" name="id" value="<?php echo $this->validation->id; ?>"/> </tr> <tr> <td valign="top">Name<span style="color:red;">*</span></td> <td><input type="text" name="name" class="text" value="<?php echo $this->validation->name; ?>"/> <?php echo $this->validation->name_error; ?></td> </tr> <tr> <td valign="top">Gender<span style="color:red;">*</span></td> <td><input type="radio" name="gender" value="M" <?php echo $this->validation->set_radio('gender', 'M'); ?>/> M <input type="radio" name="gender" value="F" <?php echo $this->validation->set_radio('gender', 'F'); ?>/> F <?php echo $this->validation->gender_error; ?></td> </tr> <tr> <td valign="top">Date of birth (dd-mm-yyyy)<span style="color:red;">*</span></td> <td><input type="text" name="dob" onclick="displayDatePicker('dob');" class="text" value="<?php echo $this->validation->dob; ?>"/> <a href="javascript:void(0);" onclick="displayDatePicker('dob');"><img src="<?php echo base_url(); ?>style/images/calendar.png" alt="calendar" border="0"></a> <?php echo $this->validation->dob_error; ?></td> </tr> <tr> <td> </td> <td><input type="submit" value="Save"/></td> </tr> </table> </div> </form> <br /> <?php echo $link_back; ?> </div> </body> </html>
personView.php to view a person details
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>SIMPLE CRUD APPLICATION</title> <link href="<?php echo base_url(); ?>style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="content"> <h1><?php echo $title; ?></h1> <div class="data"> <table> <tr> <td width="30%">ID</td> <td><?php echo $person->id; ?></td> </tr> <tr> <td valign="top">Name</td> <td><?php echo $person->name; ?></td> </tr> <tr> <td valign="top">Gender</td> <td><?php echo strtoupper($person->gender)=='M'? 'Male':'Female' ; ?></td> </tr> <tr> <td valign="top">Date of birth (dd-mm-yyyy)</td> <td><?php echo date('d-m-Y',strtotime($person->dob)); ?></td> </tr> </table> </div> <br /> <?php echo $link_back; ?> </div> </body> </html>
- Style. put stylesheet at CodeIgniter\style\style.css and style’s images at CodeIgniter\style\images folder
body { font-family:tahoma; padding:0px; margin:0px; background:#f5f5f5 } div.content { padding:10px 20px; } div.content h1 { font-size:18pt; border-bottom:5px solid #a00; padding:0px; margin:10px 0px 20px; width:80%; } div.content div.data table { border:2px solid #000; background:#fff; width:80%; } div.content div.data table td { font-size:10pt; padding:5px 10px; border-bottom:1px solid #ddd; text-align: left; } div.content div.data table th { text-align: left; font-size: 8pt; padding: 10px 10px 7px; text-transform: uppercase; color: #fff; background:url(images/head.gif) left -5px repeat-x; } div.paging { font-size: 9pt; margin:5px 0px; } div.paging a { color:#900; text-transform: uppercase; text-decoration: none; } div.paging a:hover { color:#c00; } div.paging b { color:#900; } div.success { font-size:14pt; background:url(images/accept.png) left 5px no-repeat; padding:0px; padding-left:20px; margin:0px 0px 10px; color:#060; width:80%; } a.update, a.delete, a.add, a.view, a.back { font-size: 9pt; color:#900; font-wight:bold; padding-left:20px; text-decoration: none; } a.update { background:url(images/update.png) left center no-repeat; } a.delete { background:url(images/delete.png) left center no-repeat; } a.add { background:url(images/add.png) left center no-repeat; } a.view { background:url(images/view.png) left center no-repeat; } a.back { background:url(images/prev.gif) left center no-repeat; } a.update:hover, a.delete:hover, a.add:hover, a.view:hover { color:#000; } input.text { border:2px solid #aaa; } .error { background: #FBE6F2 none repeat scroll 0 0; border: 1px solid #D893A1; color: #333333; margin: 5px 0 0; padding: 5px; font-size: 10px; font-family: Lucida Grande,Verdana,Geneva,Sans-serif; }
- Script. put script at CodeIgniter\script folder
- Done. Lets preview what should we have by now.

List of persons with pagination

Add new person

Update person

View person details

Error on validation
Download Simple CRUD Application. Happy Programming!!
Hen … pala gua nyut2an ngeliatnya xD
lunniey
April 26, 2009 at 9:35 pm
This is hot. This is exactly what I was looking for. Thanks!
Aalaap Ghag
May 8, 2009 at 8:47 pm
hoho…great and good job my bro…
i will try it…!!
Santen
May 24, 2009 at 11:10 am
Thanks Bro, You save my life 🙂
Good Job
awan pribadi
May 25, 2009 at 1:12 pm
great tutorial great job, if the admin panel is also integrates then it’s a miracleous job
thanks
netvision
May 30, 2009 at 4:54 pm
Nice tutorial, when i started with codeigniter this is the tutorial that really helped me in expediting the project great job
dharendera
May 30, 2009 at 5:06 pm
Thank You, God Bless You.
Excellent Job.
Alex Inoa
July 16, 2009 at 4:59 am
Thank you! [This should really be in the CI documentation.]
q
July 27, 2009 at 8:13 am
Awesome brother, super cool
Anuradha
August 13, 2009 at 12:31 am
I just posted on my blog a simple CRUD example with pagination and validation using CodeIgniter 1.7.1.
My example uses this one as base, which I consider a very good example for those who are starting.
Robertson Freitas
August 24, 2009 at 12:39 pm
thax a lot man.I got exactly whr i want.
kabir
August 27, 2009 at 1:50 pm
Great Job!
Just the article i needed to read to understand CI a little bit more. I just have a probleme with the redirect in the delete-function. Just see an empty page (maybe header already sent?). Wouldn’t $this->index() do the same?
Many thanks
Dirk
Dirk
August 29, 2009 at 12:27 am
Mantap nich! Udah mendukung CRUD. Saya suka. Trim’s
Nonpyrogenic
September 11, 2009 at 10:03 pm
[…] (que está mais para um Active Record Layer), incrivelmente reusável, foi inspirado no copiado do exemplo de CRUD que mencionei acima. Controller gordo + Model magro é considerado um anti-pattern, mas eu gosto […]
Robertson Freitas » CRUD Básico com CodeIgniter – versão 0.2
September 21, 2009 at 8:36 am
Thanks a lot. I was searching internet for a crud in ci. And this one serve my purpose very well. Thanks again.
Azraf
September 22, 2009 at 11:05 am
wah..keren gw lagi perlu banget nih,,
thank you very much..
Tio
October 2, 2009 at 10:41 am
What a beautiful piece of work this is: useful, beautifully presented, and a fabulous base for anyone to build on, especially since you went beyond the usual text examples and included things like radio buttons and dates. Really really nice — thank you, Henri.
Helen
October 3, 2009 at 9:04 pm
outstanding!!!!!!
acatejr
October 25, 2009 at 5:17 am
This is awesome! Easily the best getting started tutorial on CodeIgniter. Thanks!
Bill
October 28, 2009 at 10:48 am
Very nice job, very clean code, view is even better than on official examples.
All the best!
Frank
November 6, 2009 at 5:20 am
Back to the code, on linux shall be careful with naming the model. personModel.php is creating a problems, it is not loaded properly on linux.
Instead, the name shall be personmodel.php.
The class within the model shall be as it is on the example.
Best regards,
Frank
December 1, 2009 at 2:07 am
Morning,
Very interesting tutorial. I have bookmarked it so I can spend some time on it later.
Jez D
Jez D
December 21, 2009 at 5:18 pm
awesome job but I did have issues at first where the files were camelCased and this broke it. I just changed to no_camel_case and it worked.
CHeers
Boris Badenov
January 27, 2010 at 12:36 pm
Thanks a lot. I was searching internet for a crud in ci. And this one serve my purpose very well. Thanks again.
Copirait
February 1, 2010 at 12:44 am
thx a lot bro ..
ulrich
February 5, 2010 at 8:24 am
Thank you for sharing. Very helpful indeed 🙂
Chris
February 15, 2010 at 1:24 pm
outstanding!!!!!!!!!!
thanks
Rups
February 17, 2010 at 4:43 pm
u have code for friend request ?
pari
February 17, 2010 at 5:04 pm
thank u
abc
February 17, 2010 at 5:33 pm
Damn Cool!!!…
Thank you so much….
seno
February 25, 2010 at 2:07 pm
ijin nyimak..
mau belajar..
nice info, keep posting 😀
bluemeda
February 26, 2010 at 10:29 am
keren… minta ijin untuk mempelajarinya.. =)
dudu
February 28, 2010 at 6:27 pm
awesome
kodegeek
March 6, 2010 at 1:12 pm
Amazing, thank you, will try learning CI with this
JREAM
March 14, 2010 at 3:40 pm
Sorry brow.
Codenya gak jalan sewaktu add/update/delete. Css-nya juga gak ke load.
:D…Any suggest?
Andri Rahmansyah
March 25, 2010 at 12:58 am
@Andri
ga jalan yg dimaksud ntu sperti apa??
error message, log-nya??
Henri H.
March 26, 2010 at 4:47 pm
thank you!!!! it helped me a lot…
techgal
March 31, 2010 at 1:32 pm
thanks banget bro, sangat membantu saya yang baru belajar CI
gimana fungsi callback untuk mengecek apakah data sudah ada di dalam database?
mqa
April 1, 2010 at 10:16 pm
Nice, tutorial, I don’t see the styling, and only the 1st page comes up with deprecated errors. any thoughts?
learning
April 13, 2010 at 10:56 am
Hi ,
great work , thanks alot . I used it for my last project . Thanks alot man , I owe you one and greetings from IRAN
Majid
April 17, 2010 at 12:20 am
thank you so much, it so helpfull! God bless you 🙂
ar
April 29, 2010 at 7:50 am
Thanks for a great demo.
I’m new to PHP and CI.
Item 5 personModel.php is missing php tags.
I had problems with this version of CI php 5.3
until I used the 2 fixes in
https://henrihnr.wordpress.com/2009/04/26/simple-crud-application/
John
May 2, 2010 at 6:05 am
Sorry wrong url posted above:
Correct url:
http://theosmblog.com/2009/07/25/fresh-install-wamp-codeigniter-running/
John
May 2, 2010 at 6:06 am
IF you have the error, “An Error Was Encountered Unable to locate the model you have specified: personModel” when you put this on a live server you can just change the model name to something like Person_M and the function to person_M. There is something weird with having model in the name when on a live server. Don’t know why.
Kyle
May 7, 2010 at 4:57 am
Very nicely explained tutorial. But while editing or adding a new person there is this message.
A PHP Error was encountered
Severity: 8192
Message: Function ereg() is deprecated
Filename: controllers/person.php
Line Number: 199
We can replace ereg() with preg_match() for warning to disappear as follows.
file CodeIgniter\system\application\controllers\person.php
function valid_date($str)
{
if(!preg_match(“(^(0[1-9]|1[0-9]|2[0-9]|3[01])-(0[1-9]|1[012])-([0-9]{4})$)”, $str))
{
$this->validation->set_message(‘valid_date’, ‘date format is not valid. dd-mm-yyyy’);
return false;
}
else
{
return true;
}
}
Tejas Sali
May 7, 2010 at 1:54 pm
its a freaking awesome!
El John
May 18, 2010 at 9:45 am
Hi Henry
Thanks for the CRUD Application, It worked and great job you have done. Appreciate.
I want to add filters such as search by name, sex, department and Unique ID number such as QW23. How Could achieve the filters part, Could you please help for any pointer.
In addition to this, I wish to add a photograph field and make it work.
Your help would be highly appreciated.
Samuel
Samuel
June 27, 2010 at 11:23 am
[…] create, read, update and delete records (CRUD) I searched for CodeIgniter libraries. I came across this post by Henri. His solution is very simple and easy to understand and implement. In this post I’ll […]
CodeIgniter simple CRUD improved – marthijn.
June 27, 2010 at 7:39 pm
Hi Samuel,
You’re welcome.
You can add filter part using request parameter and use it in the query.
e.g. EXACT MATCH
1. create search option
2. get value at Controller
$id = $this->input->post(‘id’);
3. use as query condition
$this->db->where(‘id’, $id);
return $this->db->get(‘table_name’);
you can build advance search criteria using combination of any field and search method (LIKE, EXACT MATCH, START FROM, etc).
To add a photograph field, you can use multipart form provided by CodeIgniter and save as binary object (BLOB) to database.
e.g.
1. create upload form at .html
2. get data at Controller
$photo = $this->upload->data();
3. save to database
INSERT INTO table (photo) VALUES (‘{$photo}’)
Henri H.
June 28, 2010 at 2:58 pm
Hi Henri,
First of All, Thank you so much for your heart to help and response too. You have explained in so understanding and easy way, Many thanks for this, I have not worked though on filter part. I am trying to upload picture but that’s not going success for me. Plz help.
I have added extra one field in your controller and similarly added that field in personEdit.php, while add new record form displays like
– Name*
– Gender*
– Photo*
– Date of birth (dd-mm-yyyy)*
similarly have placed those fields in personEdit.php view file.
PROBLEM is:
if I set form parameter on personEdit.php this way
<form method="post" action="”>
It does not upload picture but keeps name of that picture(DSCI0117-copy.jpg) table_person’s field called userfile. Rest of other fields are populated properly.
BUT,
If I set form parameter
<form method="post" action="” enctype=”multipart/form-data”>, It actually uploads picture in uploads folder but none of the data is inserted to table called tbl_person.
Will you please guide me to solve this problem?
Thank you once again.
Samuel
June 30, 2010 at 1:54 am
Sorry, I forgot to mention….
While setting form parameter this way,
<form method="post" action="action="” enctype=”multipart/form-data”>
It uploads picture in upload folder WITH ERROR saying field required on PHOTO but none of the data is inserted to table called tbl_person
Thank you.
Samuel
June 30, 2010 at 2:03 am
first of all, thank you for this post.
one last question here. any table manipulation need table sort. do you have any idea about table sorting?
khangai
June 30, 2010 at 6:19 pm
Hi Henri,
It seems working now. It actually did not get post value from $this->input->post(‘userfile’)[don’t know the exact reason, why?]; but as it is assinged according as below
$this->upload->do_upload();
$this->upload->data();
$image_data=$this->upload->data();
$userfile=$image_data[‘file_name’];// <—-this line helped n seems to work now. BUT Thank you for your generous heart and help and obviously CRUD developed, appreciate you, wonderful work. Your guide and above response really helped to solve problem eg searching stuffs and uploading image stuffs. Many thanks.
By the way, I wish to ask a question, plz answer if you get time, as search results appear, I tried to display to list result page as it is displayed in listing the table data formatting. I want to display results according to that way. Will you please point me?
Thank you once again.
Samuel
Samuel
July 5, 2010 at 3:46 pm
Cool!!!
Prantoor
July 8, 2010 at 5:46 pm
mantap bro
Joe
August 7, 2010 at 9:37 pm
Thank’s my friend! Its great tutorial!!!
Fabio
August 9, 2010 at 7:26 am
with ruby on rails you would not have to write all this crap!, 1 plugin for pagination, 2 shell commands to generate db, and mvc files and some custom code for validation.
tomas
September 5, 2010 at 3:56 am
Thanks a lot 🙂
Ei Chaw San
September 20, 2010 at 1:32 pm
Very helpful, great job
thank a lot bro
Ibon
October 9, 2010 at 12:50 pm
makasih mas. your example works better than the one given by my lecturer 😛
I really appreciate your tuts and you do have a knack for clear concise instructions.
Thanks a million.
jlo
October 24, 2010 at 7:59 am
mas error nih bisa bantuin gak
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 248
An Error Was Encountered
Unable to locate the model you have specified: personmodel
ion
November 2, 2010 at 9:10 am
I could use your sample project for my academic purpose. Thank you very much.
Programmer's Forum
November 7, 2010 at 1:18 pm
Thank you very much for this excellent codeigniter CRUD tutorial!
It helps me a lot! 🙂
Nicholas
November 8, 2010 at 12:54 am
Terima kasih ya. Tulisan ini sangat membantu aku.
ciburuan
November 11, 2010 at 9:05 am
Thank you for posting this great article,,,
I have one question, if i want to upload image in personEdit form, how can i do it ?
PS: sorry for my english
ryan
November 11, 2010 at 12:47 pm
There is error at line:-226 $CI = new $class(); in CodeIgniter\system\application\controllers\CodeIgniter.php—
error is
An Error Was Encountered
Unable to locate the model you have specified: personmodel
Atish
November 11, 2010 at 1:48 pm
Ini gimana ya, kalau di db ada 10 tapi yg tampil cuma 9 ga ada link pagination,
kalau di db ada 11 halaman pertama tampil 9 ada link ” 1 2 > ” tapi di page 2 nomer (di kolom NO) langsung loncat 11 12 ?
Apa header tabelnya ikut keitung gt?
Makasih.
nafri
November 19, 2010 at 4:27 pm
halooo sir..i hAVE Any pRobleM About Link in pagination, view, update, delete..
if I Click link [pagination 1,2 >],view, update n delete can’t link to next page, or new page (View page,update page) and error masagge “The URI you submitted has disallowed characters”
please help me sir….
tar klo berhazil tak traktir sate ayam ponorogo…ok
best regards,
Addin top markotop.
Addin Choirudin
January 26, 2011 at 11:02 pm
@ion
km pake php versi berapa?cm km ganti pake codeigniter versi 1.7.2
yoky
March 10, 2011 at 9:02 am
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\CodeIgniter\system\codeigniter\Common.php on line 123
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\CodeIgniter\system\codeigniter\Common.php on line 129
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 248
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
Henri H help me ??
yamasoka
March 28, 2011 at 6:42 pm
hi mas henry.
mas klo sms gateway bisa ga menggunakan codeigniter?? terus cara merubah dari php biasa ke codeigniter???
Makasih mas.. 🙂
aung
March 29, 2011 at 9:01 am
you’re henry d’ great
thanks for your generosity in sharing your knowledge..its really a big help to many..
mariz cruz
March 30, 2011 at 10:18 am
To Yamasoka and others who might have experienced the problem on deprecating thing, have a look at this link, it solves the problem! 😉
http://theosmblog.com/2009/07/25/fresh-install-wamp-codeigniter-running/
Love, zatie
Zatie Mei Gui
March 31, 2011 at 8:19 am
And thanks to Henri H for this post. Its excellent!
Zatie Mei Gui
March 31, 2011 at 8:20 am
mcocYS http://dhY3n0fjvTtj48mG9sFnCv.com
jeremy
April 8, 2011 at 7:28 pm
wahhhh thank’s bgt nehhh scriptnya CRUDnya brjalan dengan baik
andrew
April 19, 2011 at 4:32 am
[…] https://henrihnr.wordpress.com/2009/04/26/simple-crud-application/ Click here to cancel reply. […]
Simple CRUD – CodeIgniter « Muhammad Asif Naseer
April 25, 2011 at 5:49 pm
[…] https://henrihnr.wordpress.com/2009/04/26/simple-crud-application/ […]
Архитектура за писане на web програми | Размисли
May 5, 2011 at 7:06 pm
In the addPerson action, is it necessary to add the posted values to the $person array? Couldn’t the post array be simply passed in, like below?
$id = $this->input->post(‘id’);
$this->personModel->update($id,$this->input->post());
Jonathan
May 6, 2011 at 11:20 pm
Many Thanks For Sharing, Sir
kurniawan urip
May 20, 2011 at 1:15 am
Fantastic. Learned more in an hour than I ever thought possible. Thanks!
Karl
May 24, 2011 at 7:10 am
Thanks its very helpful to me.
Mahamud
May 28, 2011 at 1:39 am
[…] – CodeIgniter Simple Explained https://henrihnr.wordpress.com/2009/04/26/simple-crud-application/ – Simple CRUD – CodeIgniter, мн добро […]
ASP.NET , PHP , WEB DESIGN | Размисли
June 3, 2011 at 2:41 pm
[…] will share the logic in the same edit function, and using a create or update approach. In the example provided by Henri, he used this approach to Add or Update a person. Simple […]
Build a form in CodeIgniter 2.0 | jigniter™
June 6, 2011 at 1:22 am
ada kah tutorial yg lebih simpel terutama dibagian controller & view….and i like your model 😉
hang2303
June 9, 2011 at 1:21 am
Hola
Does anyone have a working copy of this with fixes for CodeIgniter 2.0.2 please?
I have run into some problems and I would really like to get this working so I can learn more…
Could anyone send to me or briefly host. Thanks…
Gilberto
June 18, 2011 at 4:51 am
An Error Was Encountered
Unable to locate the model you have specified: personmodel
Gilberto
June 18, 2011 at 5:16 am
So – after a walk and some fresh air I’ve made some progress
It seems that CI doesn’t like partially capatalised filenames as in personEdit.php etc…
Fix: I had to rename the filenames and their instances in subsequent files
Gilberto
June 18, 2011 at 6:15 am
So a problem now with “validation” — I have changed this to form_validation as per CI2.0.2
and the View and Delete seem to work ok, but there is an error when navigating to ADD or EDIT
Error: Fatal error: Call to undefined method CI_Form_validation::set_fields() in /…/crud/application/controllers/person.php on line 182
Same error for both ADD and EDIT
please someone with some CI experience might help me, thanks again
Gilberto
June 18, 2011 at 6:44 am
I’m start learn CI using your code, then i make a little change. but i’m stuck when calling controlling using Routing. I want to used to do transaction using more than 1 table. Please help me.
chandrachandra
June 20, 2011 at 7:44 pm
Kalau tabel A ada relasinya dg tabel B (mungkin dg tabel C juga) dg key tertentu gmn om?
– Misal tabel A itu tabel person kyk contoh di atas,
– trs tabel B nya misal tabel yg berisi data keluarga,
– dan tabel C misalnya berisi data username/password/email..
itu gmn om?
luckyinfs
June 25, 2011 at 2:24 am
thanks brooo….
dave
June 30, 2011 at 6:25 am
Think vey much for this tuto. It helps me a lot for my project in my entreprise.and I perform the code for codeigniter 2.
but
I have some problems with the date calendar.
When I put null value, in my insert, I have the value of date:’1969-12-31′ .
if some one resolved this pb?
so, i look for a method for dependent drop-down lists for codeiginiter
think
Baradji
July 8, 2011 at 8:27 pm
Nice work Friend
tulip
July 21, 2011 at 7:11 pm
kenapa malah
Fatal error: Class ‘Controller’ not found in C:\xampp\htdocs\CodeIgniter\application\controllers\person.php on line 11
??? 😦 bantu sayaaaa
Teman
July 26, 2011 at 10:36 am
thank you
RZV
July 28, 2011 at 4:42 pm
change this part ::
function valid_date($str)
{
if(!ereg(“^(0[1-9]|1[0-9]|2[0-9]|3[01])-(0[1-9]|1[012])-([0-9]{4})$”, $str))
{
$this->validation->set_message(‘valid_date’, ‘date format is not valid. dd-mm-yyyy’);
return false;
}
else
{ return true;}}
by this one::
function checkDateFormat($date)
{
//match the format of the date
if (preg_match (“/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/”, $date, $parts))
{
//check weather the date is valid of not
if(checkdate($parts[2],$parts[3],$parts[1]))
return true;
else
return false;
}
else
return false;
}
gudluck 😉
Ardini Sri Kartika
July 31, 2011 at 9:34 pm
gan, di ci 2.02 ga jalan…udh disesuaikan cuma masih blm jalan.. set_fields gimana ya…
sholeh
August 3, 2011 at 3:47 pm
wah makasih tutorialnya, sangat membantu. belajar dari mencoba membuat sesuatu lebih cepat dari teori doank. great job many thanks
anton hilman
August 4, 2011 at 3:01 pm
incredible, great tuts, find it after long time;))
rakib006
August 7, 2011 at 11:58 am
Hi Henry,
Great CRUD work and learnt many things from this. Is this possible to create transaction lines for a particular record? Say for example, for a small medical clinic, patient is returning customer. I want to keep their history, details and transaction every time they visit.
Thank you for your help.
Samuel
Samuel
August 23, 2011 at 2:10 pm
Mantaps….ijin download bro.
asriia03
October 19, 2011 at 9:06 am
Thanks Henri this blog really help me…
I have a question how can you determine the ID of the row you want to delete???
Neil
October 22, 2011 at 8:26 am
Does not work with CodeIgniter 2.0.3.
Please suggest a fix asap.
moomin
October 22, 2011 at 12:39 pm
You are awesome man! Thanks so much!
Amit Gupta
November 3, 2011 at 5:49 pm
Very nice CRUD tutorial !!!
I just modify one thing: when you edit/delete a record, you passes the “personID” into a GET var, that var should be encrypted for security issue.
Apart from that is perfect!!!
Thanks Again
myky
November 6, 2011 at 10:19 am
HOW to run CRUD APPLICATION USING CODE IGNITER
naga
November 21, 2011 at 2:06 pm
Need help and assistance what should I do about this??
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\CodeIgniterCRUD\system\codeigniter\Common.php on line 123
Call Stack
# Time Memory Function Location
1 0.0005 683296 {main}( ) ..\index.php:0
2 0.0013 743928 require_once( ‘C:\wamp\www\CodeIgniterCRUD\system\codeigniter\CodeIgniter.php’ ) ..\index.php:115
( ! ) Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\CodeIgniterCRUD\system\codeigniter\Common.php on line 129
Call Stack
# Time Memory Function Location
1 0.0005 683296 {main}( ) ..\index.php:0
2 0.0013 743928 require_once( ‘C:\wamp\www\CodeIgniterCRUD\system\codeigniter\CodeIgniter.php’ ) ..\index.php:115
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 248
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
wilfred05777
November 23, 2011 at 3:41 am
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
any fresh idea on how to solve this problem?
wilfred05777
November 23, 2011 at 3:43 am
How Do I Solve this MR. HENRI?? please need some few advice for newbie on CI…
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 248
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
wilfred05777
November 23, 2011 at 3:58 am
IJIN SEDOT YAH GAN…. THANKS ANYWAY
VIDEO BOKEP INDONESIA
December 7, 2011 at 5:34 pm
corregí el error de tipeo:
escribiste: font-wight:bold;
y deberia ser asi: font-weight:bold;
Diego
December 20, 2011 at 4:02 am
now: font-wight:bold;
will be: font-weight:bold;
Diego
December 20, 2011 at 4:02 am
Great example. Learned a lot about CodeIgniter, PHP and HTML.
I upgraded the example to work with Codeigniter 2.XX and newer PHP version – just minor changes, but help full for new guys.
How can I send it?
Jairo
December 20, 2011 at 7:24 pm
Just post the code in the comments the easiest and fastest way.
Suomee
December 20, 2011 at 7:34 pm
When I am updating a row, all values are inserting as zeros in the row. When I see the data through this command “var_dump($_POST);” they are showing fine.
Please help me urgently..
ashoksharmaz87
December 24, 2011 at 12:06 pm
wowww mantep tutorialnya bro…
thanks sharingnya, ane coba dulu 🙂
tono
January 11, 2012 at 6:26 pm
Very nice script
Rajesh
January 17, 2012 at 6:17 pm
@wilfred05777:
That’s different PHP version. You can delete some “$” on your script
Biron
January 27, 2012 at 9:04 pm
thank you so much for nice tutorial for new users
Jitendra
February 1, 2012 at 7:28 pm
@wilfred05777:
That’s different PHP version. You can delete some “$” on your script
Biron
January 27, 2012 at 9:04 pm
Question: which of the files am I going to delete some “$” sign you said??
is it in the controller, view or model?? please I need assistance…
wilfred05777
February 3, 2012 at 6:18 am
pagination is not working???
gordie
February 16, 2012 at 11:01 pm
awesome… Thank u V much…
Siva
February 17, 2012 at 3:53 pm
hey… u made it look so easy..
thanks..
u saved me i was mugging around for this…..
SUSHIL
February 24, 2012 at 8:18 pm
there was an error while im running your crud in CODEIGNITER ..
heres the error:
Fatal error: Class ‘Controller’ not found in C:\xampp\htdocs\CI\application\controllers\person.php on line 2
i think i have problem in my adressing in the browser…
josie cayton
February 28, 2012 at 2:12 pm
[…] Simple CRUD – CodeIgniter […]
Monster Oasis » Blog Archive » useful CodeIgniter Libraries : CLI / REST / cache / CRUD
March 8, 2012 at 11:03 am
i have an error
A Database Error Occurred
Error Number: 1146
Table ‘simplecrud.tbl_person’ doesn’t exist
SELECT * FROM (`tbl_person`) ORDER BY `id` asc LIMIT 10
Filename: C:\xampp\htdocs\crud12\system\database\DB_driver.php
Line Number: 330
can you help me on this!
i download the source code, should i replace it the one’s you just posted above!
darwin
March 14, 2012 at 4:59 pm
Please any one can help me, how to solve this error?
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$id
Filename: views/personEdit.php
Line Number: 23
” />
Name*
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$name
Filename: views/personEdit.php
Line Number: 28
“/>
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$name
Filename: views/personEdit.php
Line Number: 29
Gender* M F
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$gender
Filename: views/personEdit.php
Line Number: 35
Date of birth (dd-mm-yyyy)*
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$dob
Filename: views/personEdit.php
Line Number: 39
“/> calendar
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$dob
Filename: views/personEdit.php
Line Number: 41
Girish
April 2, 2012 at 4:48 pm
if you are click on add new data then these error are display, please help me for solve this error
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$id
Filename: views/personEdit.php
Line Number: 23
” />
Name*
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$name
Filename: views/personEdit.php
Line Number: 28
“/>
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$name
Filename: views/personEdit.php
Line Number: 29
Gender* M F
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$gender
Filename: views/personEdit.php
Line Number: 35
Date of birth (dd-mm-yyyy)*
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$dob
Filename: views/personEdit.php
Line Number: 39
“/> calendar
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Form_validation::$dob
Filename: views/personEdit.php
Line Number: 41
Girish Zope
April 2, 2012 at 4:51 pm
When I tried running the application, the browser returns “Forbidden You don’t have permission to access /CodeIgniter/index.php on this server. Apache/2.2.20 (Ubuntu) Server at localhost Port 80”
What could be wrong?
ivan
April 7, 2012 at 8:40 am
@Biron what $ sign you mean? where does it specifically located at??
A M B U L A N C E N E T W O R K
April 8, 2012 at 6:50 am
convert codeigniter 2.0 ?
street
April 12, 2012 at 9:20 am
Thank you sir.
this is very usefull tutorial.
raju
April 16, 2012 at 11:56 pm
Iam getting this following error help me please.
Deprecated: Assigning the return value of new by reference is deprecated in D:\xampplite\htdocs\curd\system\codeigniter\Common.php on line 123
Deprecated: Assigning the return value of new by reference is deprecated in D:\xampplite\htdocs\curd\system\codeigniter\Common.php on line 129
raju
April 16, 2012 at 11:59 pm
iam getting this please help me .
Deprecated: Assigning the return value of new by reference is deprecated in D:\xampplite\htdocs\curd\system\codeigniter\Common.php on line 123
Deprecated: Assigning the return value of new by reference is deprecated in D:\xampplite\htdocs\curd\system\codeigniter\Common.php on line 129
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
raju
April 17, 2012 at 12:03 am
Thank you Henry (sir). This tutorial gives me a lot of confidence. I can also work on Codeigniter. Thanks a lot Henry (sir).
raju
April 17, 2012 at 12:42 am
Very very informative and one of the best tutorials on CRUD. Just love it. Thanks much!
Mindi
May 1, 2012 at 9:56 am
how do i solve the deprecated issue on this??
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 248
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
A M B U L A N C E N E T W O R K
May 1, 2012 at 2:49 pm
i guess that´s a best tutorial ever…. thank you… i´ll follow your posts now… great job… sorry for bad english i´m brazilian.
Elcio
May 9, 2012 at 2:07 am
Hi Friend , this tutoarial is nice , But when delete an entry there is a problem occur… If we have 12 entries
and have 10 per page , in that case when we go to second page and delete 1 entry after deletion the page
redirect to First page , in this CASE it’s ok … But if there is 122 entries , the admin feel bad about it , please fix that problem
Thanks
Anes
Anes P A
June 13, 2012 at 11:07 am
Hey, you emailed me requesting backlinks (to help build more traffic to your site) I’m sold up and retired now (woo hoo), so I can’t help personally, but I used a service for $39/mo while secretly marking up the price to $400-500 and selling this same service to many clients. the link is http://goo.gl/KlDCN
Virtue Vase
July 2, 2012 at 3:21 pm
OH bro you really greate for me. I, m facing many more problem in ci, but i got this my problem is solved…..
bimal chand
July 3, 2012 at 4:35 pm
i want to create a admin panel for Admin login please help me
Arvind Sharma
July 11, 2012 at 11:34 am
Sir i getting this error pls help me
Deprecated: Assigning the return value of new by reference is deprecated in /var/www/projects/Codeigniter/system/codeigniter/Common.php on line 130
Deprecated: Assigning the return value of new by reference is deprecated in /var/www/projects/Codeigniter/system/codeigniter/Common.php on line 136
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
An Error Was Encountered
The URI you submitted has disallowed characters.
arvind
July 11, 2012 at 12:52 pm
hi Henry!~
Thanks a lot!
I love you! 😉
Leslie
July 12, 2012 at 9:39 am
[…] The CMS is a PHP/MySQL-based project built via CodeIgniter (http://codeigniter.com/) The version used is 2.0.3; as of this writing CodeIgniter may be up to Version 2.1.2. Portions of the CMS are based in turn on a CodeIgniter 1.6.2 tutorial readapted for 2.0.3: https://henrihnr.wordpress.com/2009/04/26/simple-crud-application/ […]
No place like 127.0.0.1 » Blog Archive » ITM Student Portfolio: How to Use
July 23, 2012 at 6:46 am
When inserting any number in a row and displayed in a table it is shown as 0, while I see in the database it is correct. Any guest why it is?
vj86
July 25, 2012 at 10:23 pm
I couldn’t refrain from commenting. Exceptionally well written! Check out my website to get more info about bodybuilding, if you like.
creatine kinase
August 7, 2012 at 11:56 pm
[…] Clique aqui para acessar o post Share this:LinkedInFacebookTwitterGostar disso:GosteiSeja o primeiro a gostar disso. […]
CRUD em CodeIgniter « Tutoriais php
September 7, 2012 at 2:45 am
You’re so interesting! I don’t think I’ve truly read a single thing like that before. So great to discover someone with a few unique thoughts on this subject. Seriously.. thank you for starting this up. This web site is one thing that is required on the web, someone with some originality!
google merchant account
September 9, 2012 at 1:52 am
hi henri…nice tutorial…
but i have an error…
i’m trying to do the validation in my form following your tutorial…but it said unable to load requested language file…
what i did is exactly like you showed in your tutorial…
may be you know the problem, i’m waiting for your reply…thanks…
Laras Ervintyana
September 18, 2012 at 8:24 am
Very nice Tutorial ! Thanks Man…
Jesus Christ
September 18, 2012 at 9:38 am
Thank you for this! 🙂 But I’m still confused on what to pud in the browser’s url. I hope you could help me.
Maria Clara
September 23, 2012 at 8:35 am
@Laras Ervintyana
See the CI version above and the version of your CI 🙂
Semahaj Olanam Rellertse
September 25, 2012 at 11:36 pm
Hi mates, pleasant paragraph and good arguments commented here,
I am truly enjoying by these.
filtres a cartouche
September 30, 2012 at 2:22 pm
Hi Henri,
Nice Work. I am getting class validation error and I am not able to edit/update/add a file. Please helpl . and please help me if I have to submit a new form into the same db tbl_person. What MVC things should i Use.
faheemmir
October 3, 2012 at 3:44 pm
http://denvermortgage.pro I ask all my pals to pay a visit to this blog.. br .. and I hope they’ll absolutely like..
mShaneBoazbbug
October 12, 2012 at 1:12 am
masih error scriptnya br
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: controllers/person.php
Line Number: 190
saat mau nambah file dan update file.. tolong updatenya donk. terima kasih
andi
October 13, 2012 at 3:00 am
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: controllers/person.php
Line Number: 129
ini pas mau update .. error kayak di atas.. minta updatenya donk.. terima kasih
andi
October 13, 2012 at 3:01 am
Great! Finished my module within one hour… Thank you so much!
Raja MM
November 2, 2012 at 2:20 pm
An Error Was Encountered
Unable to load the requested class: validation
???
jass
November 15, 2012 at 1:11 pm
awesome.
great for me. very helpful. 🙂
Airgle
November 20, 2012 at 9:42 am
Thanks for this.
and keep sharing
Airgle
November 20, 2012 at 9:44 am
thanks you so much… now, i know this code how’s it work………………
very helpful
But i have one problem in the code. Validation is not working in the code. So, Please give me idea on that…
And Display error like that
A PHP Error was encountered
Severity: Notice
Message: Undefined property: person::$validation
Filename: controllers/person.php
Line Number: 181
Fatal error: Call to a member function set_fields() on a non-object in G:\xampp\htdocs\codeigniter_register\application\controllers\person.php on line 181
Priyanka
December 11, 2012 at 6:49 pm
bagus banget
ijin download gan
Ade Reza R S
December 17, 2012 at 11:21 am
*************************IMPORTANT*******************+
for all problems, you have to put on your config.php file
$config[‘base_url’] = ‘http://localhost’; instead of ‘http://crud-ci2.localhost/’;
and also put your files on the WWW directory (all other files move into another directory) or modify the DocumentRoot “c:/wamp/www/” for DocumentRoot “c:/wamp/www/crud-ci2/” on your httpd.conf apache file
good luck
Claudio
January 10, 2013 at 10:59 pm
awesome.
great for me. very helpful.
Thomas Varghese
January 31, 2013 at 5:42 pm
wedew…mantaph mastah codingx..bagi2 ilmux selaluw yak. thanks
Cinta Dia
February 14, 2013 at 10:09 am
How can i run this application in xampp
Amit Kansal
February 25, 2013 at 6:55 pm
How can i
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\CodeIgniter\system\codeigniter\Common.php on line 123
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\CodeIgniter\system\codeigniter\Common.php on line 129
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 248
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
Simple CRUD Application
NO NAME GENDER DATE OF BIRTH (DD-MM-YYYY) ACTIONS
1 henrihnr Male 09-09-1985 view update delete
2 name_001 Male 01-01-1990 view update delete
3 name_002 Female 01-01-2000 view update delete
4 name_003 Male 02-02-2000 view update delete
5 name_005 Female 04-04-2000 view update delete
add new datarun this application in xampp
Please help me
Amit Kansal
February 25, 2013 at 7:02 pm
Now everything is fine but while i am adding data it is showing
The URI you submitted has disallowed characters.
Amit Kansal
February 25, 2013 at 7:16 pm
LouisVuittonBagsAidsWickedCapabilitiesMethods,[url=http://www.vuittontenpo.com/]ルイヴィトン バッグ[/url],LvHandbagsOutletVeryShow!,http://vuittontenpo.com/,$32MLouisVuittonVerdictShowsLimitsWithRegardsToIspSafePorts
carpytnteyrouey
April 10, 2013 at 11:18 am
Thanks for your write-up. I also feel that laptop computers have gotten more and more popular lately, and
now will often be the only kind of computer used in a household.
This is due to the fact that at the same time they are becoming more and more inexpensive, their computing power is growing to
the point where these are as strong as pc’s coming from just a few in years past.
Lorraine
April 21, 2013 at 4:16 pm
There’s definately a lot to learn about this topic. I love all the points you have made.
tarif porte de garage sectionnelle
May 31, 2013 at 10:46 pm
What’s up, of course this paragraph is in fact pleasant and I have learned lot of things from it regarding blogging. thanks.
hair removal
June 1, 2013 at 2:45 pm
hi please help when i want to edit this error message show in the header
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: controllers/person.php
Line Number: 130
threadbooster
June 17, 2013 at 2:15 pm
Hello would you mind stating which blog platform you’re working with? I’m going to start
my own blog soon but I’m having a difficult time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something unique.
P.S Sorry for getting off-topic but I had to ask!
Location voiture Casablanca
June 20, 2013 at 9:16 am
thank alot to give such a wonderful code
dfg
July 2, 2013 at 1:53 pm
The actual bingo halls are usually creating method for on-line bingo bedrooms.
You will find mainly a couple several types of bonus deals throughout on the internet bingo
Grand Parker
July 14, 2013 at 5:50 am
How to fix this error thanks:
__________________________
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: controllers/team.php
Line Number: 128
bot
July 16, 2013 at 1:25 pm
To answer my previous answer here is the answer.
Just add this
function _set_fields()
{
$this->form_data = new stdClass();
/some code here
}
reference: http://www.trash-factor.com/content/php-error-creating-default-object-empty-value
bot
July 16, 2013 at 1:50 pm
Very Good
thank you!!!!
Atam HEMAT
July 16, 2013 at 1:59 pm
it is applicable to codeigniter 2.1.4??? i tried to load but the welcome message is always appeared.
King
July 27, 2013 at 11:41 am
SCRIPT ERROR..?
Ricco Anggara
August 15, 2013 at 2:30 pm
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\CodeIgniter\system\codeigniter\Common.php on line 123
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\CodeIgniter\system\codeigniter\Common.php on line 129
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
rajendra
August 28, 2013 at 8:37 pm
Thank for this tutorial, bro…. i wanna ask u. when i was click ‘add new data’ then show some trouble :
A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: controllers/person.php
Line Number: 190
Can u explain and solve case above.? thanks before…, but overall the function can running very well. only statement above is a bit annoying
regards
Dim’s from indonesia
dim's
September 16, 2013 at 3:24 pm
@rajendra go to index.php and set error_reporting(E_ALL) to error_reporting(E_ALL & ~E_DEPRECATED);
or try changing set_magic_quotes_runtime(0); to ini_set(“magic_quotes_runtime”, 0);
i guess it’s a problem with your php version.
@henrihnr this is the best! 😀
phyll
September 19, 2013 at 3:01 am
nice tutorial… love it. thanks..
Slamet Budi Santoso
November 4, 2013 at 6:39 am
I have it working for the most part, but I am adding additional date fields and the datepicker does not work on any file not named dob…any suggestions?
Reese Troute
November 13, 2013 at 7:25 am
To stop the errors
function _set_fields()
{
$this->form_data = new stdClass;
$this->form_data->id = ”;
$this->form_data->name = ”;
$this->form_data->gender = ”;
$this->form_data->dob = ”;
}
Michael
November 22, 2013 at 1:05 am
thanks
sopian
December 1, 2013 at 10:58 am
Reblogged this on ::.
cacingus
December 8, 2013 at 7:18 pm
Fatal error: Class ‘Controller’ not found in C:\xampp\htdocs\datakaryawan\application\controllers\person.php on line 2
help me
eddy
January 5, 2014 at 6:48 pm
Hi Henri Thanks for the super awesome CI crud app. Very well explained. But I have a question.
I used this Person files and used the same files as Department. I did edit all the other relative fields. But the Department Controller file do not load the index method in it. But Person function very well. Can someone please help me with this?.
sophia
January 27, 2014 at 3:07 pm
its very nice my dear friend this is what really i need
thank u very much
pradeep
February 12, 2014 at 1:45 pm
I am Manuja Sudasingha.Very very good example you have given..Thank you.
Manuja Sudasingha
March 5, 2014 at 11:08 am
Hi Henri!
Tell me please: how to make adding/editing entries on the form of the General list, and not in a separate form?
Thank you!
Aleksey
April 21, 2014 at 6:30 pm
[…] https://henrihnr.wordpress.com/2009/04/26/simple-crud-application/ […]
CodeIgniter | Ravindra Singh Moyal
May 4, 2014 at 7:50 pm
awesome article. This is what I have been finding for a long time
Thanks very much.
kamza
May 23, 2014 at 1:42 pm
Hey there just wanted to give you a quick heads up and let you know a few of the images aren’t loading correctly.
I’m not sure why but I think its a linking issue.
I’ve tried it in two different web browsers and both show the same results.
steeldrumband.info
July 5, 2014 at 4:09 pm
Hi Henrihnr, Thanks a lot for taking time to write this valuable post and sharing with us. Im new to CI in learning over internet tutorial yours is simple to learn CRUD. This code works fine for me. But Im having a small doubt. In all other tutorials the model and controller are extends from CI_Model and CI_Controller but yours is not. Can you please guide me on this…
Charles
July 18, 2014 at 10:35 pm
Nice Tutorial…i got useful information from this tutorial,here is a way to findsimple registration form using codeigniter
simple
October 5, 2014 at 1:57 pm
very nice tutorial for php developer, when refresh this page add same data in table, how to prevent this type of entry
Thanks
sanjay kumar
October 12, 2014 at 2:37 pm
thanks its really helpful for me,
ffff
October 28, 2014 at 8:55 pm
[…] Simple CRUD – CodeIgniter – Henri Blog | Study and … – Apr 26, 2009 · Nice tutorial, when i started with codeigniter this is the tutorial that really helped me in expediting the project great job… […]
Fix Codeigniter Database Query Error Windows XP, Vista, 7, 8 [Solved]
November 19, 2014 at 10:54 am
Deprecated: Assigning the return value of new by reference is deprecated in C:\newwamp\www\CodeIgniters\system\codeigniter\Common.php on line 123
Call Stack
# Time Memory Function Location
1 0.0008 375352 {main}( ) ..\index.php:0
2 0.0036 423168 require_once( ‘C:\newwamp\www\CodeIgniters\system\codeigniter\CodeIgniter.php’ ) ..\index.php:115
( ! ) Deprecated: Assigning the return value of new by reference is deprecated in C:\newwamp\www\CodeIgniters\system\codeigniter\Common.php on line 129
Call Stack
# Time Memory Function Location
1 0.0008 375352 {main}( ) ..\index.php:0
2 0.0036 423168 require_once( ‘C:\newwamp\www\CodeIgniters\system\codeigniter\CodeIgniter.php’ ) ..\index.php:115
A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 248
A PHP Error was encountered
Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: database/DB.php
Line Number: 133
That show this type error .please solve this type error and give replay
raj
November 22, 2014 at 1:28 pm
[…] PDF File Name: Simple crud – codeigniter – henri blog | study and share Source: henrihnr.wordpress.com » DOWNLOAD « […]
Contoh Script Codeigniter
January 8, 2015 at 3:38 am
hey…it shows the error
The URI you submitted has disallowed characters.
my codeigniter version is 2.2.1 and php version is 5.5.12
Manish
February 16, 2015 at 7:54 pm
when i click the add new data, this will be the output:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Person::$validation
Filename: controllers/person.php
Line Number: 177
Fatal error: Call to a member function set_fields() on a non-object in C:\xampp\htdocs\crud_CI\application\controllers\person.php on line 177
kiddie
February 26, 2015 at 5:19 pm
go to application/config/autoload.php
add in library
example :
$autoload[‘libraries’] = array(‘database’,’session’,’form_validation’,’table’);
Thanks
sanjay yadav
February 26, 2015 at 8:24 pm
Great Post. I just want to share this site PDFFiller, Inc which I use to eSign my documents. I can also get third party digital signatures from my employees and clients. You can get a free trial if you ask for it.
http://go.gl/SA1pfw
Jill Rivas
March 3, 2015 at 8:20 am
PHP Codeigniter – Learn PHP Codeigniter Framework From Scratch
Alex Phan
March 19, 2015 at 10:13 pm
thanks a lot. It’s very helpful tutorials.
Muhamad Akbar Bin Widayat
April 9, 2015 at 10:26 am
Simply awesome! Very Thank! is just I needed.
My blog is http://www.programertech.com.ar if you wan see my posts about technologies
Alejandro
May 15, 2015 at 4:17 am
thanks sir am doing work on curd with the help of your code thanku
AMANDEEP KAUR
August 5, 2015 at 4:46 pm
I do not even understand how I finished up here, but I thought this put up used to be great. I don’t recognize who you’re however definitely you are going to a famous blogger if you happen to aren’t already Cheers!
Ralph Chubicks
March 20, 2016 at 3:35 pm
Its vital to do your homework into which trading platform to trade with before you decide which broker to use check out this site it has a list of broker’s reviews
Oscar Kane
March 21, 2016 at 5:58 pm
Good.we can auto create crud in codeigniter with our inputs using http://crudgenerator.in
phpdreamworld
April 24, 2016 at 9:15 pm
Thank you for sharing your great suggestions. I have a site ” http://www.musicinstruments.tv ” which promotes and shares new talent and some pros with their videos. Verify it out! I am always browsing for new ideas.
Rocky Manheim
April 30, 2016 at 4:47 am
Just wanna input on few general things, The website design is perfect, the content is rattling good : D.
Beatrice Krzesinski
August 19, 2016 at 8:22 pm
Highly informative look forwards to returning. http://bit.ly/2f0xJ92
New healthy man
November 12, 2016 at 5:38 am
Breaking the Silence of the Lambs
Breana Bovard
November 27, 2016 at 8:13 am
I¡¦ve been exploring for a little for any high-quality articles or weblog posts in this kind of area . Exploring in Yahoo I finally stumbled upon this site. Studying this info So i am glad to show that I’ve an incredibly just right uncanny feeling I found out exactly what I needed. I so much undoubtedly will make sure to don¡¦t forget this site and give it a glance on a continuing basis.
Zachary Mcclave
December 1, 2016 at 12:56 pm
Having read this I believed it was extremely enlightening. I appreciate you finding the time and effort to put this informative article together. I once again find myself spending a lot of time both reading and commenting. But so what, it was still worthwhile!|
Nicky Kagle
December 4, 2016 at 8:59 pm
Howdy very nice site!! Man .. Beautiful .. Wonderful .. I will bookmark your website and take the feeds additionally¡KI am glad to seek out so many helpful info right here within the publish, we’d like develop extra techniques on this regard, thank you for sharing. . . . . .
Aiko Carreker
December 8, 2016 at 8:39 am
I dugg some of you post as I cogitated they were very beneficial very helpful
Lorrie Pallant
December 14, 2016 at 10:28 pm
You have mentioned very interesting details ! ps nice site. “I understand a fury in your words, But not the words.” by William Shakespeare.
Carmine Rinkus
December 22, 2016 at 12:57 am
Have you ever considered creating an ebook or guest authoring on other blogs?I have a blog based on the same subjects you discuss and would love to have you share some stories/information. I know my visitors would enjoy your work.If you are even remotely interested, feel free to shoot me an e-mail.
Luciano Peddy
December 25, 2016 at 7:51 am
Many thanks, this site is really handy.|
Kurtis Gnagey
December 29, 2016 at 8:47 pm
I’m gone to inform my little brother, that he should also visit this weblog on regular basis to take updated from newest gossip.|
Davina Lompa
January 5, 2017 at 3:57 am
Simply want to say your article is as astonishing. The clarity on your put up is simply nice and that i can suppose you are knowledgeable in this subject. Well with your permission let me to grab your feed to stay updated with impending post. Thank you 1,000,000 and please keep up the enjoyable work.|
Valrie Lobell
January 19, 2017 at 11:28 pm
you’re really a just right webmaster. The website loading pace is amazing. It sort of feels that you’re doing any distinctive trick. Furthermore, The contents are masterpiece. you’ve done a magnificent activity on this matter!
Russ Giacomo
January 22, 2017 at 4:09 am
you’re truly a excellent webmaster. The site loading speed is amazing. It kind of feels that you’re doing any unique trick. Also, The contents are masterpiece. you’ve done a fantastic job in this subject!
Lorrine Roets
January 23, 2017 at 4:19 am
※当店の商品は全て国内正規販売元の検品を経て納品された商品を販売しております。 ポンチョカーディガン
Alexander Tozier
February 3, 2017 at 7:51 pm
I was studying some of your posts on this site and I conceive this site is very instructive! Retain putting up.
Sachiko Janus
February 4, 2017 at 6:39 pm
Thankfulness to my father who told me on the topic of this website, this website is truly remarkable.|
Dara Howdyshell
February 10, 2017 at 12:12 am
なっていくのかもしれません。マウジー トレンチコート http://www.bodymotion.com/flash/mini/name/20141203013109-e3839ee382a6e382b8e383bc-e38388e383ace383b3e38381e382b3e383bce38388-wqnj.html
Quyen Salloum
February 11, 2017 at 9:35 pm
Yeah, Afi is fast as a shark when it comes to try new games,
especially when these games are alive at one of his favorite casinos, Casumo.
serchup.com
September 1, 2017 at 6:02 pm
Our community is better because you are in it. When I turned on my browser this website was running. You have a lot of knowledge on this subject.
Jesse Grillo
September 6, 2017 at 4:53 am
I will post a website link to this page on my weblog. I am absolutely sure my site visitors will find that incredibly useful.
Desire Takaoka
January 20, 2018 at 9:54 pm
[…] Simple CRUD – CodeIgniter | Henri Blog – Apr 26, 2009 · A couple months ago i have developed PHP application. That’s was the first time (and the only one) i used CodeIgniter. The development itself only took a. […]
Why Ada Trading Bot |
February 21, 2018 at 5:03 pm
Thank you for sharing your information on creating applications. I think I will also start this, now I’m editing the forms on https://www.pdffiller.com/
Dorothy Bishop
March 6, 2018 at 8:11 pm