[eluser]RobertB.[/eluser]
Hello again,
Where can I define variables so the m/v/c share it with out have to declare them in each functions. Example of what I mean.
Code:
function Name()
{
$cat = $this->uri->segment(3, 0);
$this->db->select('s.id, s.state, COUNT(b.is_active) AS active');
$this->db->from('states AS s');
$this->db->join('businesses AS b', 's.id = b.state_id', 'left');
$this->db->where('b.cat_id', $cat);
$this->db->or_where('b.state_id', NULL);
$this->db->groupby('s.id');
$this->db->order_by('s.state', "asc");
I don't want to declare the variable inside the function because I use it in multiple functions in the same model. I try to do in on the top of the model but does not work. I hope I've explained myself.
Thanks.