public function store($name , $description ,$created ,$modified ,$created_by,$modified_by,$deleted_at,$id) {
try{
$this->name = $name;
$this->description = $description;
$this->created = $created;
$this->modified = $modified;
$this->created_by = $created_by;
$this->modified_by = $modified_by;
$this->deleted_at = $deleted_at;
$this->$id = $id;
$sql = "UPDATE `categories` SET `name` = :name, `description` = :description, `created` = :created, modified = :modified ,`created_by` = :created_by, `modified_by` = :modified_by, `deleted_at` = :deleted_at WHERE `id` = :id ";
$stmt =$this->conn->prepare($sql);
$stmt->bindParam(':name', $this->name,\PDO::PARAM_STR);
$stmt->bindParam(':description',$this->description,\PDO::PARAM_STR);
$stmt->bindParam(':created',$this->created,\PDO::PARAM_INT);
$stmt->bindParam(':modified',$this->modified,\PDO::PARAM_INT);
$stmt->bindParam(':created_by', $this->created_by,\PDO::PARAM_INT);
$stmt->bindParam(':modified_by',$this->modified_by,\PDO::PARAM_INT);
$stmt->bindParam(':deleted_at',$this->deleted_at,\PDO::PARAM_INT);
$stmt->bindParam(':id', $this->id,\PDO::PARAM_INT);
//$stmt = $this->conn->prepare($sql);
//print_r($stmt);
$stmt->execute();
var_dump($stmt);
}
catch (PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
}
即使没有错误但无法正常工作
答案 0 :(得分:0)
尝试更改
$this->$id = $id; to $this->id = $id;