Welcome Guest, Not a member yet? Register   Sign In
[Solved] How to "clear" Active Record limits?
#1

[eluser]mtbkrdave[/eluser]
Hi Y'all-

This would seem like a pretty silly question, but I can't seem to find a resolution in the manual or forums...

If I want to do multiple database queries in a single function, how do I "clear" the conditions in-between queries?

Code:
$this->db->where('var_1','data_1');
$query1 = $this->db->get('table1');

$this->db->where('var_2','data_2');
$query2 = $this->db->get('table2');

In the example above, how would I prevent the 'var_1' condition from applying to the second query being AND'ed with the second where() statement??

Thanks,
[medic]dave
#2

[eluser]manilodisan[/eluser]
Does the first condition affect the 2nd when running the code? I doubt that...
#3

[eluser]mtbkrdave[/eluser]
As is often the case, a little trial-n-error confirms your suspicion!

It seems that the query conditions are reset after the query is run.

Thanks!
[medic]dave




Theme © iAndrew 2016 - Forum software by © MyBB