public function update($table, $data, $where, $option = '') { if (empty($data) || empty($where)) { return false; } $sql = SqlBuilder::buildUpdateSql($table, $data, $where, $option); $stmt = $this->_dao->prepare($sql); $params = $this->buildParams($data, $where); $this->bindParams($stmt, $params); if ($stmt->execute()) { return $stmt->affected_rows; } return false; }
public function update($table, $data, $where, $option = '') { if (empty($data) || empty($where)) { return false; } $sql = SqlBuilder::buildUpdateSql($table, $data, $where, $option); $params = null; if (is_array($data)) { $params = array_values($data); } if (is_array($where)) { $params = array_merge($params, array_values($where)); } $stmt = $this->_dao->prepare($sql); $result = $stmt->execute($params); $affect_count = $stmt->rowCount(); return $affect_count === 0 ? $result : $affect_count; }