Developing a Website with CodeIgniter Part 2: Users Database Table and the User Model

This screencast continues a series with the goal of documenting the development of a functionally complete site using PHP with the CodeIgniter framework and jQuery for Javascript UI improvements including AJAX interactions.

This video covers the creation of a database table for storing users and the CodeIgniter model class for interacting with it.

Errata:

I've noticed a few errors in the screencast. When errors creep up (and they will) I'll audit them as they're discovered and keep this post up to date.  Errors will also be updated during the following screencast.

  1. The UpdateUser method "set password" line (line 80) contains the variable $options['userEmail'] instead of $options['userPassword'].
  2. The UpdateUser method is missing the line $this->db->where('userId', $options['userId']); This should be added before the line that contains $query = $this->db->update('users'); (line 84)
  3. The AddUser method's default value is set incorrectly (line 48). It currently shows array('userStatus', 'active') where it should read array('userStatus' => 'active').