Welcome Guest, Not a member yet? Register   Sign In
$this->db->where() from previous query, in an other model, is sticking around and messing up a different query in anothe
#1

[eluser]Unknown[/eluser]
How would I clean everything out, so that the where parts of my last query in a different model are not carried through once that query is complete?
#2

[eluser]Pert[/eluser]
Could be two things I can think of right now

You have a random where statement somewhere in the code that does not follow <b>$this->db->get()</b> so it is stored for any active record query that actually does call get / insert / update / ... methods. Maybe do a quick find in files and try to located where such where statement might be made.

You can call internal method in the beginning of your other query to clear everything

$this->db->_reset_write();

The problem with that is it will only clear it for one query, if any other db call is made in between, that query would get wrong where statement included.

Or active record caching (last section)

http://ellislab.com/codeigniter/user-gui...ecord.html
#3

[eluser]Unknown[/eluser]
Thank you!

It's not a random where...I know right where it's happening and can test and confirm that.

I was able to come up with a temporary solution, that is working fine, it just feels like a big hack. I basically just added an extra $this->db->get statement in the end of my method where the $this->db->where statements are being used.

This clears it out successfully. I don't like it though, I am going to keep playing with it.




Theme © iAndrew 2016 - Forum software by © MyBB