CRUD operation in CodeIgniter | PHP Gurukul
In previous tutorial we learned how to insert data into data in CodeIgniter. In this tutorial we will learn how to fetch data from database in CodeIgniter. 1. Create a model(Read_data_Model.php) inside application/mode 1 2 3 4 5 6 7 8 < ? php Class Read_data_Model extends CI_Model { public function readdata ( ) { $ query = $ this -> db -> select ( 'fullName,mobileNumber,emailId,gender,address,termsCondition,postingDate' ) -> get ( 'tblusers' ) ; return $ query -> result ( ) ; } } 2. Create a controller(Read_data.php) inside application/controller 1 2 3 4 5 6 7 8 9 10 11 < ? php Class Read_data extends CI_Controller { public function index ( ) { //load model $ this -> load -> model ( 'Read_data_Model' ) ; //load model function $ results = $ this -> Read_data_Model -> readdata ( ) ; ...