Welcome Guest, Not a member yet? Register   Sign In
retriving value from database with get_where
#1

[eluser]jonyork[/eluser]
Alright Im trying to retrive the number of rows where members are individual and active.

Ive narrowed the problem to my model. Everything was working fine until I added a second clause to my get_where

Here is my model function

Code:
function count_individual_active_members()
    {
        $query = $this->db->get_where('Membership', array('Membership_Status' => 'Active', 'Membership_cat' => 'Individual'));
        return $query->num_rows();
    }

What and I doing wrong, and how can I fix it?

thanks
#2

[eluser]jonyork[/eluser]
Sorry guys,

fixed it on my own Big Grin

Code:
function count_individual_active_members()
    {
        $query = $this->db->where(array('Membership_Status' => 'Active', 'Membership_Cat' => 'Individual'));
        $query = $this->db->get('Membership');
        return $query->num_rows();
    }
#3

[eluser]WanWizard[/eluser]
That's odd, because that is exactly what get_where() does.

Can you humor me, and do a echo $this->db->last_query() for both solutions, and see if there are any differences? If this is a bug than it needs to be reported.




Theme © iAndrew 2016 - Forum software by © MyBB