CodeIgniter: Showing Simple All Data


CodeIgniter Step By Step Tutorial: We have set database and create table for CodeIgniter practice. Now, we learn how to show data in CodeIgniter. As we know, CodeIgniter use MVC pattern. We will use Model for retrieve data from database.

First, build a model. Create a file named "employee_model.php" within CodeIgniter/CodeIgniter\system\application\models. Enter following code:

codeigniter - model database

Next, we make a view. Create a file named "employee_viewall.php" within CodeIgniter\system\application\views. Enter folowing code:

codeigniter - view

Build controller. Create a file named "employee.php" within CodeIgniter\system\application\controllers. Enter following code:

codeigniter - controller

Now, try to point your browser to http://localhost/CodeIgniter/index.php/employee/getall

codeigniter


Series this article:
CodeIgniter: Introduction to CodeIgniter Framework
CodeIgniter: Installation
CodeIgniter: Creating First Application at CodeIgniter
CodeIgniter: Creating and Sending Parameters Between Controller and View
CodeIgniter: Getting Parameters From GET
CodeIgniter: Setting Database Configuration
CodeIgniter: Preparing Database
CodeIgniter: Showing Simple All Data
CodeIgniter: Showing Simple One Data
CodeIgniter: Choosing a Data From GET

Bookmark and Share Tag: CodeIgniter, framework, MVC, parameter, controller, view, data Category: PHP Framework Post : January 25th 2008 Read: 154,089

advertisements


blog comments powered by Disqus