I'm using codeigniter/datamapper to develop an inviocing application and I'm getting an error that i don't understand. If I do the following:
$i = new Invoice();
$i->save();
Then i get the following error: A Database Error Occurred
You must use the "set" method to update an entry.
Filename: /Users/jim/Sites/example.com/libraries/Datamapper.php
Line Number: 1635
However I can run this all day without any problem:
$i = new Invoice();
$i->notes ='x';
$i->save();
Just wondered why it behaves like this? Any help/comments much appreciated. Thanks
解答:
For the datamapper you must assign the value to the object. If the object is empty then it is not going to save. So firstly set the value for the datamapper object.
比如在用rest工具测试的时候,post请求体没有内容,或者没有设置,会导致提示这个信息
如何联系我:【万里虎】www.bravetiger.cn 【QQ】3396726884 (咨询问题100元起,帮助解决问题500元起) 【博客】http://www.cnblogs.com/kenshinobiy/