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