CodeIgniter报错: You must use the "set" method to update an entry
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请求体没有内容,或者没有设置,会导致提示这个信息
CodeIgniter报错: You must use the "set" method to update an entry的更多相关文章
- java8 list转Map报错Collectors.toMap :: results in "Non-static method cannot be refernced from static context"
1.问题:java8 list转Map 报错Collectors.toMap :: results in "Non-static method cannot be refernced fro ...
- 用apache-cxf生成webservice客户端的时候报错Parameter: shead already exists for method
版本apache-cxf-3.1.0 命令如下:wsdl2java -p com.wz.interfaces -d ./src -client ./ws/xxx.wsdl 报错如下: WSDLToJa ...
- ExtJs 4.2.1 报错:Uncaught TypeError: Cannot call method 'getItems' of null
做项目的时候遇到这个问题,搞了一上午终于解决了,让我们看看是什么问题: buttons: [ { text: '保存', icon: '../../../Images/extjs/disk.png', ...
- React报错:Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix,
今天在开发时报了以下错误,记录一下 我们不能在组件销毁后设置state,防止出现内存泄漏的情况 出现原因直接告诉你了,组件都被销毁了,还设置个锤子的state啊 解决方案: 利用生命周期钩子函数:co ...
- Feign调用远程服务报错:Caused by: java.lang.IllegalStateException: Method getMemberInfo not annotated with HTTP method type (ex. GET, POST)
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ord ...
- Mysql报错Error Code: 1175. You are using safe update
使用MySQL执行update的时候报错:Error Code: 1175. You are using safe update mode and you tried to update a tabl ...
- 【pheatmap热图scale报错】Error in hclust(d, method = method):NA/NaN/Inf in foreign function call (arg 11)
初始数据类似如下: 填充下缺失值 data[data==0] <- NA data[is.na(data)] <- min(data,na.rm = T)*0.01 pheatmap(lo ...
- Java报错:Unable to find setter method for attribute: [x]
在学习JavaWeb JSTL与自定义标签时遇到的坑,用的老师给的代码结果直接原地报错:javax.servlet.ServletException: org.apache.jasper.Jasper ...
- mysql uodate 报错 You can't specify target table '**' for update in FROM clause
You can't specify target table 'sc' for update in FROM clause 背景:把“sc”表中“叶平”老师教的课的成绩都更改为此课程的平均成绩: 上面 ...
随机推荐
- Request.InputStream 接收Post Data
今天 用 Request.Form /Request.Params 等怎么也获取不到客户发过来的Post 数据 后来试着用了 Request.InputStream 竟然可以 using (Syste ...
- memcached安装和php-memcached扩展安装.update.2014-08-15
服务器端主要是安装memcache服务器端,目前的最新版本是 memcached-1.3.0 .下载官网:http://www.danga.com另外,Memcache用到了libevent这个库用于 ...
- Canvas与Image互转
function fImageToCanvas(image){ var oCanvas = document.createElement("canvas"); oCanvas.wi ...
- URAL 1932 The Secret of Identifier 题解
http://acm.timus.ru/problem.aspx?space=1&num=1932 B - The Secret of Identifier Time Limit:1000MS ...
- matlab之waitbar() delete() close()
matlab之waitbar() delete() close() 三者之间的关系: 在显示某个程序的进度时,用waitbar函数显示进度条,当程序进行完毕时,用close 或 delete函数关闭此 ...
- TYVJ1460 旅行
描述 A国有n座城市,每座城市都十分美,这使得A国的民众们非常喜欢旅行.然而,A国的交通十分落后,这里只有m条双向的道路,并且这些道路都十分崎岖,有的甚至还是山路,只能靠步行.通过每条道路的长度.泥泞 ...
- editplus快捷键大全之editplus光标快捷键
前面我们讲了editplus快捷键大全之editplus文件快捷键,现在我们介绍一下editplus快捷键大全之editplus光标快捷键 移动光标到上一个制表符Shift+Tab 移动光标到上一个制 ...
- Spring3中的mvc:interceptors标签配置拦截器
mvc:interceptors 这个标签用于注册一个自定义拦截器或者是WebRequestInterceptors. 可以通过定义URL来进行路径请求拦截,可以做到较为细粒度的拦截控制. 例如在配置 ...
- C语言内存对齐详解(3)
接上一篇:C语言内存对齐详解(2) 在minix的stdarg.h文件中,定义了如下一个宏: /* Amount of space required in an argument list for a ...
- UITextField竖直居中对齐
http://blog.sina.com.cn/s/blog_87533a0801012nv0.html 用xib生成的UITextField文字默认是水平左对齐,垂直居中对齐的,但是用代码生成的UI ...