简体   繁体   English

发生数据库错误:您必须使用“set”方法来更新条目

[英]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.

相关问题 错误:您必须使用“set”方法更新条目 - Error:You must use the “set” method to update an entry 错误:您必须使用“set”方法来更新条目修复? - Error: You must use the "set" method to update an entry fix? CodeIgniter DataMapper错误:您必须使用“set”方法来更新条目 - CodeIgniter DataMapper Error: You must use the “set” method to update an entry CI4 您必须使用“设置”方法来更新条目。 已经用set了,还是报错 - CI4 You must use the "set" method to update an entry. Already use set, still error Codeigniter您必须使用“设置”方法来更新条目5 - Codeigniter You must use the “set” method to update an entry 5 Codeigniter:您必须使用“set”方法来更新条目 - Codeigniter: You must use the “set” method to update an entry 您必须使用“set”方法来更新条目如何在 php codenniter 中纠正 - You must use the "set" method to update an entry how to rectify in php codengniter Codeigniter4 显示即使我使用了“set”方法,运行更新查询时也必须使用“set”方法 - Codeigniter4 shows You must use the "set" method when running update query even I used "set" method 必须使用设定方法 - Must use set method 使用Codeigniter计算所有结果的方法时发生数据库错误 - A Database Error Occurred in counting all results method using Codeigniter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM