Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

518补丁后辩论帖出现问题

[复制链接]
乐七 发表于 2012-5-21 10:20:35 | 显示全部楼层 |阅读模式
本帖最后由 乐七 于 2012-5-21 11:04 编辑

  • 按立场筛选:
  • 全部
  • 正方
  • 反方
  • 中立




选择任何立场都会爆mysql错误。



(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 '1 ORDER BY p.dateline LIMIT 10' at line 1
SELECT dp.*, p.* FROM forum_post p LEFT JOIN forum_debatepost dp ON p.pid=dp.pid WHERE p.tid=3024 AND p.`invisible`='0'1 ORDER BY p.dateline LIMIT 10
PHP Debug

No.        File        Line        Code
1        forum.php        58        require(%s)
2        source/module/forum/forum_viewthread.php        536        table_forum_post->fetch_all_debatepost_viewthread_by_tid(%s, %s, %d, %s, false, %d, %d, %d)
3        source/class/table/table_forum_post.php        216        discuz_database::query(%s, Array)
4        source/class/discuz/discuz_database.php        136        db_driver_mysql->query(%s, false, false)
5        source/class/db/db_driver_mysql.php        151        db_driver_mysql->halt(%s, %d, %s)
6        source/class/db/db_driver_mysql.php        218        break()
m.king 发表于 2012-5-21 17:51:43 | 显示全部楼层
该问题我们已经收录 感谢您的反馈!
回复

使用道具 举报

sumnerboy 发表于 2012-5-28 16:26:21 | 显示全部楼层
这个是mysql语句有问题
找到/source/class/table/table_forum_post.php里的fetch_all_debatepost_viewthread_by_tid
替换下面内容
  1. public function fetch_all_debatepost_viewthread_by_tid($tid, $visibleallflag, $authorid, $stand, $forum_pagebydesc, $ordertype, $start, $limit) {
  2.                                 
  3.                 $data = array();
  4.                 $parameter = $this->handle_viewthread_parameter($visibleallflag, $authorid, $forum_pagebydesc, $ordertype, 'p.');
  5.                
  6.                 $query = DB::query("SELECT dp.*, p.* FROM %t p LEFT JOIN %t dp ON p.pid=dp.pid WHERE p.tid=%d".
  7.                                 ($parameter['invisible'] ? ' AND '.$parameter['invisible'] : '').($parameter['authorid'] ? ' AND '.$parameter['authorid'] : '').
  8.                                 (isset($stand) ? ' AND (dp.stand=%d OR p.first=1)' : ' AND (dp.stand=0 OR dp.stand IS NULL OR p.first=1)').
  9.                                 ' '.$parameter['orderby'].
  10.                                 ' '.DB::limit($start, $limit),
  11.                                 array(self::get_tablename('tid:'.$tid), 'forum_debatepost', $tid, $stand));
  12.                 while($post = DB::fetch($query)) {
  13.                         $data[$post['pid']] = $post;
  14.                 }
  15.                 return $data;
  16.         }
复制代码
回复

使用道具 举报

shady76 发表于 2012-6-11 15:11:54 | 显示全部楼层
找到/source/class/table/table_forum_post.php里的fetch_all_debatepost_viewthread_by_tid
把整个函数替换成如下内容,可完美解决(QQ199_38_133,作为一个高手,我习惯了孤独):
  1. public function fetch_all_debatepost_viewthread_by_tid($tid, $visibleallflag, $authorid, $stand, $forum_pagebydesc, $ordertype, $start, $limit) {
  2.                                 
  3.                 $data = array();
  4.                 $parameter = $this->handle_viewthread_parameter($visibleallflag, $authorid, $forum_pagebydesc, $ordertype, 'p.');
  5.                
  6.                 $query = DB::query("SELECT dp.*, p.* FROM %t p LEFT JOIN %t dp ON p.pid=dp.pid WHERE p.tid=%d".
  7.                                 ($parameter['invisible'] ? ' AND '.$parameter['invisible'] : '').($parameter['authorid'] ? ' AND '.$parameter['authorid'] : '').
  8.                                 (isset($stand) ? ' AND (dp.stand=%d OR p.first=1)' : ' AND (dp.stand=0 OR dp.stand=1 OR dp.stand=2 OR dp.stand IS NULL OR p.first=1)').
  9.                                 ' '.$parameter['orderby'].
  10.                                 ' '.DB::limit($start, $limit),
  11.                                 array(self::get_tablename('tid:'.$tid), 'forum_debatepost', $tid, $stand));
  12.                 while($post = DB::fetch($query)) {
  13.                         $data[$post['pid']] = $post;
  14.                 }
  15.                 return $data;
  16.         }
复制代码
回复

使用道具 举报

gcjun123 发表于 2012-6-15 04:00:10 | 显示全部楼层
shady76 发表于 2012-6-11 15:11
找到/source/class/table/table_forum_post.php里的fetch_all_debatepost_viewthread_by_tid
把整个函数替 ...

使用后,全部功能失效
回复

使用道具 举报

eonbell 发表于 2012-6-19 14:36:25 | 显示全部楼层
简单的替换只会让帖子只显示中立的回复
应该是替换213行为下列语句


(isset($stand) ? ($stand ? ' AND (dp.stand=%d OR p.first=1)' : ' AND (dp.stand=0 OR dp.stand IS NULL OR p.first=1)') : ' ' ).
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-2-25 14:24 , Processed in 0.027796 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表