Javatpoint Logo
Javatpoint Logo

CodeIgniter SELECT Database record

To fetch all data from database, one more page in Model folder of CodeIgniter will be created. There will be some changes in controller's and view's files also.

Controller file (Baby_form.php) is shown below.

We have added a constructor to load the model page. Highlighted code is added to fetch the inserted record. And our view page is now baby_form_select.php

View file (baby_form_select.php) is shown below.

Code in baby_form_select.php file is same as baby_form_add.php. Above codes are added to fetch the record.

Here we have fetched the record in a table with the help of foreach loop. Function fetchtable() is created to fetch the record.

Model file (babymodel.php) is shown below.

In URL, type http://localhost/CodeIgniter/index.php/Baby_form

Codeigniter Select database record 4

Look at the above snapshot, all data has been fetched from the table 'baby'.





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA