簡體   English   中英

發生數據庫錯誤:您必須使用“set”方法來更新條目

[英]A Database Error Occurred: You must use the "set" method to update an entry

這是代碼:

$this->db->where('id', $id);
return $this->db->update('contractors', ((array) $contractor));

它給了我錯誤A Database Error Occurred: You must use the "set" method to update an entry.

您的問題缺少$contractor數組,所以我在這里可能是錯的,但是當我在 CI 中收到此錯誤時,通常是因為我沒有使用鍵/值對正確格式化我的更新/插入數據數組。

$contractor = array(
"name" => "John",
"phone" => "123-123-1234"
);
$this->db->where('id', $id);
return $this->db->update('contractors', $contractor);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM