How to fetch data from a table CodeIgniter?

This code explains how to fetch data from a table in CodeIgniter.

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

This block of code of will explains about how to delete data from table using CodeIgniter.
Which involves mainly three steps.

  1. Model
  2. Controller
  3. View
Once you aware of setting up the database you can move ahead with this example.
Model:
Models are PHP classes that are designed to work with information in your database. For example, let’s say you use CodeIgniter to manage a blog. You might have a model class that contains functions to insert, update, and retrieve your blog data.
Fetching data from database table.
Levels.php

Controller:

A Controller is simply a class file that is named in a way that can be associated with a URI. Consider this URI: example.com/index.php/ blog / In the above example,CodeIgniter would attempt to find a controller named blog.php and load it. When acontroller’s name matches the first segment of a URI, it will be loaded.

Storing the data in an array.
Welcome.php


View
Displaying data in a table.
demodata.php
Spread the love

2 comments

  1. I’m impressed, I need to say. Really not often do I encounter a blog that’s both educative and entertaining, and let me tell you, you could have hit the nail on the head. Your idea is excellent; the problem is one thing that not enough persons are speaking intelligently about. I am very comfortable that I stumbled across this in my seek for one thing referring to this.

Leave a Reply

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