Welcome Guest, Not a member yet? Register   Sign In
Active Records
#6

[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.


Messages In This Thread
Active Records - by El Forum - 03-04-2010, 08:13 PM
Active Records - by El Forum - 03-05-2010, 02:42 AM
Active Records - by El Forum - 03-05-2010, 02:56 AM
Active Records - by El Forum - 03-05-2010, 07:45 AM
Active Records - by El Forum - 03-05-2010, 09:07 AM
Active Records - by El Forum - 03-05-2010, 01:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB