Welcome Guest, Not a member yet? Register   Sign In
prevent database update when no where statement found
#2

[eluser]Michael Wales[/eluser]
Don't carelessly omit the where statement.

Code:
function save($id = NULL, $new_data = array()) {
  if ((is_int($id)) && (count($new_data) > 0)) {
    $query = $this->db->update('table', $new_data, array('id' => $id));
    if ($this->db->affected_rows() === 1) {
      return TRUE;
    }
  }
  return FALSE;
}


Messages In This Thread
prevent database update when no where statement found - by El Forum - 01-09-2009, 01:19 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 01:32 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 01:33 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 01:41 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 01:55 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 02:10 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 02:23 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 02:37 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 02:42 PM
prevent database update when no where statement found - by El Forum - 01-09-2009, 03:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB