title: Retrieving data from multiple tables on Codeigniter
body: <p>I'm trying to retrieve data from multiple tables on CI, I've been looking for a similar answer or example but didn't found one. Here is what I've done so far.</p>
  
  <p>This is the function to retrieve the data I need on model 'anuncios_model.php'</p>
  
  <pre><code>public function return_all_for_id($id){
      $this-&gt;db-&gt;select('anuncios.*');
      $this-&gt;db-&gt;select('usuarios.id, usuarios.link, usuarios.nombre');
      $this-&gt;db-&gt;select('departamentos.nombre_departamento');
      $this-&gt;db-&gt;select('categorias.nombre, categorias.link');
      $this-&gt;db-&gt;select('subcategorias.nombre, subcategorias.link');
      $this-&gt;db-&gt;from('anuncios, usuarios, departamentos, categorias, subcategorias');
      $this-&gt;db-&gt;where('anuncios.id_anuncio', $id);
      $where = 'anuncios.id_cat = categorias.id AND anuncios.id_subcat = subcategorias.id AND anuncios.id_user = usuarios.id AND anuncios.id_departamento = departamentos.id_departamento';
      $this-&gt;db-&gt;where($where);
      return $result = $this-&gt;db-&gt;get();
  }
  </code></pre>
  
  <p>Since I was just testing my luck, this is the function I've been calling on my controller 'anuncio.php'</p>
  
  <pre><code>public function test(){
      $data['result'] = $this-&gt;anuncios_model-&gt;return_all_for_id(1);
      $this-&gt;load-&gt;view('pages/test' ,$data);
  }
  </code></pre>
  
  <p>And my view 'test.php'</p>
  
  <pre><code>&lt;?php
      print_r($result);
  ?&gt;
  </code></pre>
  
  <p>All I'm getting whenever I run 'anuncio/test' is:</p>
  
  <pre><code>CI_DB_mysql_result Object ( [conn_id] =&gt; Resource id #29 [result_id] =&gt; Resource id #38 [result_array] =&gt; Array ( ) [result_object] =&gt; Array ( ) [custom_result_object] =&gt; Array ( ) [current_row] =&gt; 0 [num_rows] =&gt; 1 [row_data] =&gt; )
  </code></pre>
  
  <p>Am I missing something?</p>