0

I got this error when I tried to update records in DB. Is it because of the "fetch"? I know INSERT cannot use fetch/fetchall, update is the same thing?

public function inActive($id) {
    $stmt = $this->dbh->prepare("Update " . self::TABLE_NAME . " Set `IsActive`=0 WHERE `ID`=:id");
    $stmt->bindParam(':id', $id);
    return $this->execute($stmt);
}

protected function execute($stmt) {
    $stmt->setFetchMode(PDO::FETCH_CLASS, 'ContactVO');
    $stmt->execute();
    $vo = array();
    try {
        while ($row = $stmt->fetch()) {
            $vo [] = $row;
        }
    } catch (PDOException $e) {
        echo 'Error: ' . $e->getMessage();
    }
    return $vo;
}
Layla Wang
  • 27
  • 7

0 Answers0