Welcome Guest, Not a member yet? Register   Sign In
Is it a Active Record Class where(), like() limitation?
#1

[eluser]Nano HE[/eluser]
HI.

I got a question on Active Record Class usage, my code snippet below.

Code:
$this->db->select('year, distance, gender, rank, name, chiptime, racenumber');
$this->db->order_by("year", "desc");
$this->db->order_by("distance, gender, rank", "asc");
$year = 2010;    
$this->db->where('year', $year);   // where() doesn't work!
$this->db->like('rank', $keyword); // Assume I didn't add like() with $keywords, where() works well.
$this->db->or_like('name', $keyword);

When I bind $this->db->like() after $this->db->where() in my Active Recrod Class, the $this->db->where() wont' work again. It will show all the years record that including the $keyword.

Is it a limitation in Active Recrod Class, or I didn't find a right way to bind where() and like().

Appreciated for your replies.
#2

[eluser]Nano HE[/eluser]
Chaining style used to solve my problem
Code:
$year = 2009;                
$this->db->where('year', $year)->like('name', $keyword)->or_like('chiptime', $keyword)->or_lik('racenumber', $keyword);

it works now.




Theme © iAndrew 2016 - Forum software by © MyBB