Discuz! X1.5 访问群组group.php页面提示数据库错误的解决方法
访问群组group.php页面提示数据库错误的解决方法:(同时还包括DIY群组幻灯片失效,DIY显示群组名和主题失效)
Discuz! Database Error
The database has encountered a problem. Need Help?
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`>=\’1287454216\’ 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: 0440]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)
已经将此出错信息详细记录, 由此给您带来的访问不便我们深感歉意
打开 source/class/block/group/block_groupattachment.php 文件
找到
$query = DB::query(“SELECT attach.*,t.tid,t.author,t.authorid,t.subject $sqlfield
FROM `”.DB::table(\’forum_attachment\’).”` attach
$sqljoin
INNER JOIN `”.DB::table(\’forum_thread\’).”` t
ON `t`.`tid`=`attach`.`tid` AND `displayorder`>=\’0\’
WHERE $htsql AND `attach`.`readperm`=\’0\’ AND `attach`.`price`=\’0\’
$sql
$sqlban
$sqlgroupby
$orderbysql
LIMIT $startrow,$items;”
);
改为
$query = DB::query(“SELECT attach.*,t.tid,t.author,t.authorid,t.subject $sqlfield
FROM `”.DB::table(\’forum_attachment\’).”` attach
INNER JOIN `”.DB::table(\’forum_thread\’).”` t
ON `t`.`tid`=`attach`.`tid` AND `displayorder`>=\’0\’
$sqljoin
WHERE $htsql AND `attach`.`readperm`=\’0\’ AND `attach`.`price`=\’0\’
$sql
$sqlban
$sqlgroupby
$orderbysql
LIMIT $startrow,$items;”
);
即可。