title: CodeIgniter/PHP/MySQL: Retrieving data with JOIN
body: <p>I'm new to PHP/MySQL and super-new to CodeIgniter..
  I have information in many MySQL tables. I want to retrieve it with JOIN where the tables primary keys are equal to $variable... How can I do it and get all the fields without the primary key field???</p>
  
  <p>What I'm doing now is this (only two tables joined here):</p>
  
  <pre><code>function getAll($id) {
  
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('movies');
      $this-&gt;db-&gt;join('posters', 'movies.id= posters.id');
      // WHERE id = $id ... goes here somehow...
      $q = $this-&gt;db-&gt;get();
  
      if ($q-&gt;num_rows() == 1) {
          $row = $q-&gt;row();
          $data = array(
                  'id' =&gt; $row-&gt;id,
                  'title' =&gt; $row-&gt;title,
                  'year' =&gt; $row-&gt;year,
                  'runtime' =&gt; $row-&gt;runtime,
                  'plotoutline' =&gt; $row-&gt;plotoutline,
                  'poster_url' =&gt; $row-&gt;poster_url
              );
      }
  
      $q-&gt;free_result();
      return $data;
  </code></pre>
  
  <p>id (PK), title, year, runtime and plotoutline are columns from the first table and poster_url is a field from the second table. The second table also contains an ID (PK) column that I don't want to Retrieve because I already have.</p>