作者:烟台中海地产有限公司往 | 来源:互联网 | 2014-05-27 15:53
Errormessages:[Type]查询语句错误[1054]Unknowncolumnt.fidinonclause[Query]SELECTattach.*,t.tid,t.author,t.authorid,t.subject,f.namegroupnameFROM`forum_attachment`attac
Error messages:
[Type] 查询语句错误
[1054] Unknown column 't.fid' in 'on clause'
[Query] SELECT attach.*,t.tid,t.author,t.authorid,t.subject , f.name groupname FROM `forum_attachment` attach LEFT JOIN forum_forum f ON t.fid=f.fid LEFT JOIN forum_forumfield ff ON f.fid = ff.fid INNER JOIN `forum_thread` t ON `t`.`tid`=`attach`.`tid` AND `displayorder`>='0' WHERE `attach`.`dateline`>='1292861675' AND `attach`.`readperm`='0' AND `attach`.`price`='0' AND t.isgroup='1'AND `attach`.`isimage` IN ('1', '-1') ORDER BY `attach`.`dateline` DESC LIMIT 0,4;
Program messages:
[Line: 0034]group.php(require)
[Line: 0140]source/module/group/group_index.php(include)
[Line: 0429]data/template/1_diy_group_index.tpl.php(output)
[Line: 1022]source/function/function_core.php(block_updatecache)
[Line: 0204]source/function/function_block.php(block_groupattachment->getdata)
[Line: 0298]source/class/block/group/block_groupattachment.php(DB->query)
[Line: 0837]source/class/class_core.php(DB->_execute)
localhost 已经将此出错信息详细记录, 由此给您带来的访问不便我们深感歉意
错误是因为forum_thread(也就是t表)内关联未引入时,就预先调用了t.fid 导致SQL错误,
在网上查了查,没有找到解决问题,去官方论坛查看,有人提出了问题,但是无解,没办法,只好自己开始读康盛的源代码
最终锁定问题出在source/class/block/group/block_groupattachment.php
原来的
FROM `".DB::table('forum_attachment')."` attach $
"wp_keywordlink_affiliate">sqljoin
INNER JOIN `".DB::table('forum_thread')."` t
ON `t`.`tid`=`attach`.`tid` AND `displayorder`>='0'
修改后的正确
FROM `".DB::table('forum_attachment')."` attach
INNER JOIN `".DB::table('forum_thread')."` t
ON `t`.`tid`=`attach`.`tid` AND `displayorder`>='0'
$
"wp_keywordlink_affiliate">sqljoin
恐怕这是一个BUG,个人觉得Discuz X代码封装得乱七八糟