[英]A Database Error Occurred: You must use the "set" method to update an entry
This is the code:这是代码:
$this->db->where('id', $id);
return $this->db->update('contractors', ((array) $contractor));
And it gives me the error A Database Error Occurred: You must use the "set" method to update an entry.
它给了我错误
A Database Error Occurred: You must use the "set" method to update an entry.
Your question is missing the $contractor
array so I might be wrong here, but when I get this error in CI, it's usually because I dont' have my update/insert data array correctly formatted with key/value pairs.您的问题缺少
$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.