views:

19

answers:

1

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

    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

A: 

Sorry guys,

fixed it on my own :D


 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();
 }

JonYork
Not sure what you did to troubleshoot and fix it, but it's usually helpful to use $this->db->last_query() to find out exactly what query was executed (so you can see what you screwed up).
ebynum
Was it simply the column name was wrong? Membership_cat instead of Membership_Cat. SQL is case sensitive for column names.
Stephen Curran