Follow us on Facebook
Faucibus toroot menuts
In this tutorial, I am going to show you how a sipple Insert, update and delete operation can be performed using CodeIgniter. This step by step tutorial will help you to understand the basics of how the MVC of this framework works.
First, let's set-up base URL of the project
Please, open config.php within codeigniterapplicationconfig. Set config like below:
We need to do database configuration also.
Please, open database.php within codeigniterapplicationconfig. Set config like below:
We will learn about showing data from database in CodeIgniter. But, before that, we prepare a database for practice. This post create a database named “ci_test” and a table named “users”. We use phpMyAdmin for easy.
Open your phpmyadmin.
Enter database name “ci_test” in create new database field.
Click the Create button. Your database will be created.
Create new table by running this query in your sql window:
Insert some sample data to your users table by running this query in your sql window:
Showing the details
Once our database setup is donem, our next task is to display the records that we have just entered. SInce displaying data is one of the easiest steps in CRUD operation , that's why we are going to do this first.
First, build a model. Create a file named “registration_model.php” within codeigniter/application/models. Enter the following code:
After this we need to create view page. The view page will help us to display the data received from model via controller.
The Best Websites for Free Online Courses, Certificates, Degrees, and Educational Resources