The Active Record in CodeIgniter is quite different to the AR you may find in Rails or other frameworks. The way that Active Record in CodeIgniter works is that you build up your queries using different functions. For simple queries, you might only need to use one or two functions, but for some you may need to use more—for example, if you have to look for certain conditionals, such as where a username and password are the same.
All of the functions in this section will build SQL SELECT
queries. All of the SQL in this section is MySQL; other database systems may differ slightly.
The simplest query that you can do with Active Record is to select a full database table. This is done with one single function:
$this->db->get();
This would create the SQL query:
SELECT * FROM `table_name`
This function has three parameters. The first is the name of the database table. The second lets you set a limit, and the third lets you set an offset.
$query...