Advertisement
Guest User

Untitled

a guest
May 7th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. TABLE
  2. id city_name
  3. 1 Union
  4. 2 Marthasville
  5.  
  6. $data = array('city_name', 'Marthasville');
  7.  
  8. //update record 2 from Marthasville to the same thing, Marthasville.
  9. $this->db->where('id', 2);
  10. $this->db->update('table', $data);
  11.  
  12. if($this->db->affected_rows() > 0)
  13. {
  14. //I need it to return TRUE when the MySQL was successful even if nothing was actually updated.
  15. return TRUE;
  16. }else{
  17. return FALSE;
  18. }
  19.  
  20. if($this->db->affected_rows() >= 0){ }
  21.  
  22. $result = $this->db->update('table', $data);
  23.  
  24. if($result)
  25. {
  26. //without error even no row updated
  27. } else {
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement