A good place for us to begin is to display a list of our users. We're going to create a model, view, and controller to provide the functionality to do this.
We're going to create the following three files:
path/to/codeigniter/application/models/users_model.php
: This file gives us CRUD support with the databasepath/to/codeigniter/application/views/users/view_all_users.php
: This file contains aforeach
loop, which runs through the results array, writing all users to a tablepath/to/codeigniter/application/controllers/users.php
: This file contains the code necessary to handle the CRUD functionality
Copy the following code into the,
path/to/codeigniter/application/controllers/users.php
file:<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); class Users extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('form'); $this->load->helper('url'); $this->...