22 September 2011

Selecting from multiple tables using ActiveRecord in CodeIgniter. Basics are the same as in query. You select multiple tables, relate tables and select the output fields.

Source code viewer
  1. // Just an example
  2. $count = $this->db
  3. ->from('user')
  4. ->from('auth')
  5. ->where('auth.user_id = user.user_id')
  6. ->where('user.username', $user)
  7. ->where('auth.auth', do_hash($pass))
  8. ->count_all_results();
  9.  
Programming Language: PHP