Welcome Guest, Not a member yet? Register   Sign In
Active Record Issue with Like/Where
#1

[eluser]Mischievous[/eluser]
Here is my code:
Code:
function products($term = NULL)
    {
        if(isset($term))
        {
            foreach($this->product_fields as $index => $field)
            {
                if($index == 0)
                {
                    $this->db->like($field, $term);
                } else {
                    $this->db->or_like($field, $term);
                }
            }
            //$this->db->group_by('product_sku.product_id');
            $this->db->join('product', 'product_sku.product_id = product.product_id');
            $this->db->where('product.pd_active', 1);
            $this->db->where('product_sku.sku_active', 1);
            $result = $this->db->get('product_sku');
            if($this->db->count_all_results() > 0 )
            {
                $request = $result->result_array();
                return $request;
            } else {
                return FALSE;
            }
        } else {
            return FALSE;
        }
    }
Here is my problem:
Its not taking the where statements into consideration? I've checked the database and the products i've requested are not active and yet it still comes up? like its totally disregarding the where statement all together because possible the like statements?


Messages In This Thread
Active Record Issue with Like/Where - by El Forum - 04-23-2010, 02:20 PM
Active Record Issue with Like/Where - by El Forum - 04-23-2010, 02:29 PM
Active Record Issue with Like/Where - by El Forum - 04-23-2010, 04:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB