[eluser]glasses092[/eluser]
Hi everyone,
Can anyone help me with this, I've been trying to do some code in my model that has one main method to retrieve all results (lots of selects/joins are going to be in here) and a second method that calls this method to filter based on the where...
Code:
<?
public function get_all()
{
$this->db->get($this->table);
//lots of joins in here
return $this->db->last_query(); //Do I have to have to return the SQL, can I return the object?
}
public function get_one($id)
{
$query = $this->get_all();
$result = $this->db->where('id', $id)->query($query);
return $result;
}
?>
The where clause is not applied, but I've no idea why...
I need to use a main method (get_all) as I don't want to rewrite all joins, selects etc... again and I don't want to put a 'where' clause in the 'get_all' method...
Does anyone have any ideas/suggestions/ways to make it work, I'd appreciate the help.
Thanks