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
Please follow and like us:

Leave a Reply

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