Welcome Guest, Not a member yet? Register   Sign In
Showing inactive products using where('status','active');
#2

[eluser]czetsuya[/eluser]
Hi,

This is because of the active class functions that you have used:
Code:
$this->db->like('name',db_clean($term));
$this->db->or_like('shortdesc',db_clean($term));
$this->db->or_like('longdesc',db_clean($term));
$this->db->where('status','active');

//that statements produced
//WHERE name LIKE '%$term%' OR shortdesc LIKE '%$term%' OR longdesc LIKE '%$term%' AND status='active'

Note the OR.

Try this:
Code:
$this->db->where("(name LIKE '%$term%' OR shortdesc LIKE '%$term%' OR longdesc LIKE '%$term%') AND status='active'")

Take note of the parenthesis ( )

Regards,
czetsuya


Messages In This Thread
Showing inactive products using where('status','active'); - by El Forum - 11-08-2009, 07:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB