CRUD operations using CodeIgniter Part – 1

Yuvraj Khavad

In this article, I will explain to you how to perform CRUD operation using CodeIgniter with MySql database.
Note: Full CRUD operation will cover by more than one tutorial series. In this, you will learn how to install CI and any HTML template and how to divide HTML theme different views.

What is a CodeIgniter?

CodeIgniter is open source PHP Application Development Framework and CodeIgniter id light wait MVC (Model, View, Controller) based and object-oriented programming PHP framework. Please refer google for more details.

What is a CRUD operations?

CRUD is a short form of create, read, update and delete and mostly used with MySql.

Before start practice first understand all thing about CodeIgniter at https://www.tutorialspoint.com/codeigniter/ they explained all thing very easily in the simple language

Please follow below all steps. Best of luck and if have any questions just write down your comments at below comment section, We will replay you as soon as possible.

Step: 1 Install CodeIgniter

Download latest CodeIgniter form official website and then create a folder (CodeIgniter-crud-operations) and extract zip file at working environment. I am doing at my local computer.


Step 2: Include the bootstrap HTML template in the application

For demo purpose, we are using https://github.com/BlackrockDigital/startbootstrap-heroic-features this free template. Download from GitHub and unzip it and then rename a folder to a template.

Step 3: Set application base URL

For includes jQuery and CSS files need base URL of the application, You can set base URL in file application/config/config.php line number 26

Step 4: Create views

In this step, I will create all views for insert, delete and shows data.

Now I will create a blow views file in following path application/views/ in folders includes and an employee.

4.1 header.php

Don’t forget to add base URL before css link.

4.2 footer.php

4.3 employee_list.php

Step 5: Add URL auto load helper

add URL in autoload helper in the following path application/config/autoload.php

Step 6: Create Controller

In this step, we will create a controller to handle all operation.

Now I will create an Employee.php file in following path application/controllers/.

Step 7: Run application

Open your web browser and run http://localhost/projects/codeigniter-crud-operations/index.php/Employee this URL

you will show a result as per below.

Leave a Reply

Your email address will not be published. Required fields are marked *

author-image

Yuvraj Khavad

Co-Founder, Programmer

I’m Yuvraj Khavad, I work at Z Index Solutions and BeFunky.in where I am the Co-founder!. I’m also like to read books and draw a painting. I have more than 5 years of experience in web development and web design.