Please Look At This Update Statement |
[eluser]smatakajr[/eluser]
Hey Guys Here is the statment $this->db->where('status_id !=','6'); $this->db->where('status_id !=','5'); $this->db->update('relationships',$data,$update_on) will this produce the desired update relationships set ... where ... and status_id != 6 and status_id != 5 Please advise if i can construct this like so or is it safer to write out the query in plain mysql Thanks Rick
[eluser]Dam1an[/eluser]
If you write it out in SQL directly, it will be marginally quicker (although you'd probably have to have all your statements in SQL to even notice the slightest difference) but you lose the portability, so if you then move to a differant RDBMS wit differant syntax, you'd have to rewrite it, whereas with the AR, you'd change a single value and all should work
[eluser]smatakajr[/eluser]
Thanks for your response. Basicly i just wanted to be EXTRA sure that the above statment will equate to the correct SQL $this->db->where('status_id !=','6'); $this->db->where('status_id !=','5'); $this->db->update('relationships',$data,$update_on) will this produce the desired update relationships set ... where ... and status_id != 6 and status_id != 5 Because the ->update() has 2 arrays to craft the statment i just want to make sure that the 2 ->where() clauses will tag onto the correct SQL Is there a way you know of to test this out without executing the query or is it safer to just write a PLAIN SQL statement with the ->query() function Thanks Rick
[eluser]n0xie[/eluser]
Just turn on the output profiler and you'll see what query is constructed by the AR class.
[eluser]John_Betong[/eluser]
User_Guide: http://ellislab.com/codeigniter/user-gui...lpers.html Code: $this->db->last_query(); 88 |
Welcome Guest, Not a member yet? Register Sign In |