我正在使用cakephp 2.6.7。为什么saveField()没有在CakePHP 2.x中保存记录?
在型号/ ResellerAccount:
<?php
class ResellerAccount extends AppModel {
var $name = "resellerAccounts";
}
?>
我的表名是reseller_accounts。
在控制器:
function moneySentToreseller($id = null) {
if ($id) {
$this->loadModel('ResellerAccount');
$this->ResellerAccount->id = $id;
$this->ResellerAccount->saveField("ResellerAccount.status", "sent");
$msg = '
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong> Money send to this reseller succeesfully </strong>
</div>';
$this->Session->setFlash($msg);
}
return $this->redirect($this->referer());
}
但现场没有被更新。我的代码中发生了什么错误?
我注意到你问了很多问题,在蛋糕上,你应该花点时间阅读[docs](http://book.cakephp.org/2.0/en/越来越-started.html#工具入门)。 – skywalker