Codeigniter.tvbeta

Codeigniter video tutorials and screencasts

Extending the Codeigniter core: MY_Model part 2

Creating all the get methods

Author: Joost van Veen

2011/12/29

Second in the Codeigniter.tv series 'Creating a MY_Model'.

In this episode we will create all Read functionality. We will create the following methods:

  • get() - which will return one, multiple or all records from a database
  • get_by() - which will return records filtered by one or more fields
  • get_key_value() - which will return records as a key => value pair array
  • get_assoc() - which will return one, multiple or all records as an associative array.