Welcome Guest, Not a member yet? Register   Sign In
Select Query


I am trying to perform a simple select query in CI. No coditions at this point or anything like that, just simply Select * From 'table' and pass this to a controller and then onto a view.

I'm sure this is really simple but im unable to get it to work. Im constantly receiving the error 'undefinded variable' etc.

here is my model.

function featured_list()
  $query = $this->db->get('featured');
  return $query->result();

and my controller

$query['name'] = $this->featured->featured_list();
// Load 'liked' view
$this->template('liked', $query);

In my view I just have a var_dump($query);

Any help would be great.


You dont need<code>$this->db->select();</code>. You only need it when specifying certain fields you want to get.

Can you post your viewfile and the full error? I assume the error is generated in the view file.

Have you tried a <code>echo $this->db->last_query();</code>

Theme © iAndrew 2016 - Forum software by © MyBB