title: Codeigniter: Select from multiple tables
body: <p>How can I select rows from two or more tables?</p>
  
  <p>I'm setting default fields for a form, and I need values from two tables...</p>
  
  <p>My current code reads:</p>
  
  <pre><code>    $this-&gt;CI-&gt;db-&gt;select('*');
      $this-&gt;CI-&gt;db-&gt;from('user_profiles');
      $this-&gt;CI-&gt;db-&gt;where('user_id' , $id);
      $user = $this-&gt;CI-&gt;db-&gt;get();
      $user = $user-&gt;row_array();
      $this-&gt;CI-&gt;validation-&gt;set_default_value($user);
  </code></pre>