为什么错误不提示
时间:2011-07-31
来源:互联网
$Form = M("Pic_post");
$condition['cid'] = array('eq',$cid);
$condition['status'] = 5;
$list = $Form->where($condition)->limit($num)->order('id desc')->select();
我id是 pid
按理应该提示
#1054 - Unknown column 'id' in 'order clause'
可是为什么不提示!怎么开启提示呢?谢谢了
只是把sql打印出来!我要的是提示错误!不知道有没有这个功能
$condition['cid'] = array('eq',$cid);
$condition['status'] = 5;
$list = $Form->where($condition)->limit($num)->order('id desc')->select();
我id是 pid
按理应该提示
#1054 - Unknown column 'id' in 'order clause'
可是为什么不提示!怎么开启提示呢?谢谢了
只是把sql打印出来!我要的是提示错误!不知道有没有这个功能
作者: cyr11 发布时间: 2011-07-31
没想到论坛这样冷静
作者: cyr11 发布时间: 2011-08-01
看了一下源码
dbmysql.class.php
加了一点代码
复制代码
现在终于爽了!~
错误的sql打印出来!
dbmysql.class.php
加了一点代码
- if ( false === $this->queryID ) {
- if ( $this->debug ) {
- return $this->error();
- }else{
- $this->error();
- return FALSE;
- }
- }
错误的sql打印出来!
作者: cyr11 发布时间: 2011-08-01
想来想去
这样更合适一点!先留个记号
复制代码
这样更合适一点!先留个记号
- thinkphp/lib/think/db/driver/dbmysql.class.php
-
- public function error() {
- if ( false === $this->queryID ) {
- $this->error = mysql_errno($this->_linkID)."\n注意看说明:\n".mysql_error($this->_linkID);
- if($this->debug && '' != $this->queryStr){
- $this->error .= "\n [ SQL语句 ] : \n";
- }
- return $this->error;
- }
- }
-
- thinkphp/lib/think/db/db.class.php
- protected function debug() {
- // 记录操作结束时间
- if ( $this->debug ) {
- G('queryEndTime');
- Log::record($this->error().$this->queryStr." [ RunTime:".G('queryStartTime','queryEndTime',6)."s ]",Log::SQL);
- }
- }
作者: cyr11 发布时间: 2011-08-01
你开启调试模式 就会提示错误了
作者: thinkphp 发布时间: 2011-08-01
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28