How to get id of last updated row |
[eluser]wasconet[/eluser]
I know i can use Code: $this->db->insert_id to get the last insert, but it doesnt work for me.
[eluser]sv3tli0[/eluser]
Check the documentation its into the first lines http://ellislab.com/codeigniter/user-gui...lpers.html Code: $this->db->affected_rows()
[eluser]wasconet[/eluser]
Code: $this->db->affected_rows() Thanks
[eluser]sv3tli0[/eluser]
Sorry, I misunderstand you. There is no logical way to get affected ID.. It may be 0 , 1 or many.. Usually you update/delete using that id.. Perhaps you may catch it with select before updating.. Code: SELECT id FROM table WHERE (updateWHEREcases)
[eluser]jairoh_[/eluser]
in my experience that's not possible unless you specify the primary key. |
Welcome Guest, Not a member yet? Register Sign In |