wangsisi 发表于 2011-7-9 17:23:52

Database error (SQL query hidden)的调试方法

说起来也奇怪,有一个页面在登录情况下显示正常,但在匿名访问时就出错了,提示如下

Database error

Jump to: navigation, search
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
(SQL query hidden)
from within function “SqlBagOStuff::set”. Database returned error “1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘�N����/\�:��i��ֆ�l+F���ni ~\�9��:-\rl�����W�q�{\�\r�����^t��;\�5O�W�s����’ at line 1 (localhost)”.


因为SQL语句隐藏起来了,不知道具体什么问题,希望能显示显示出来

参考了一下Manual:How to debug,原来如此简单,在/LocalSettings.php末尾增加一下几行就可以了

123 $wgShowSQLErrors = true; $wgDebugDumpSql= true; $wgShowExceptionDetails = true;

刷新一下页面,出错的SQL语句出来了,出错原因也一目了然,因为数据中多处了一个未转义的。

魔龙天神 发表于 2011-8-17 03:44:15

谢谢了。。。 我很赞成,继续努力吧











static/image/common/sigline.gif

http://img2081.poco.cn/mypoco/myphoto/20110719/00/6035253720110719001551028.png
页: [1]
查看完整版本: Database error (SQL query hidden)的调试方法

美国主机评测网站