سلام
public function update($column, $value, $primaryKey)
{
$stmt = $this->con->prepare("UPDATE $this->table SET :column = :value WHERE $this->primaryKey = :primaryKey");
$stmt->execute(['column' => $column, 'value' => $value, 'primaryKey' => $primaryKey]);
}
$folderModel = new Folder();
$folderModel->update('name', 'asd', 59);
چرا من وقتی به این شکل اسم ستون رو به متد پاس میدم کوئری اجرا نمیشه و باید حتما توی کوئری مستقیما اسم ستون رو بنویسم؟ به این شکل:
$stmt = $this->con->prepare("UPDATE $this->table SET name = :value WHERE $this->primaryKey = :primaryKey");