示例#1
0
文件: DaoAdapter.php 项目: zhxia/nspf
 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;
 }
示例#2
0
文件: DaoAdapter.php 项目: zhxia/nspf
 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;
 }