本帖最后由 sky94132003 于 2014-08-06 03:20:32 编辑
//所有版块
@$row_fid = "SELECT * FROM `forum_forum` ORDER BY `displayorder` ASC";
$stmt = $pdo->prepare($row_fid);
$stmt->execute();
$row_forum = $stmt->fetchAll(PDO::FETCH_ASSOC);
//主题分类
foreach ($row_forum as $key => $value) {
$fid = $value["fid"];
@$sql = "SELECT `typeid`,`name` FROM `forum_topic_type` WHERE `fid` = $fid";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$row_type = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
print_r($row_type);
$smarty -> assign("all_forum",$row_forum);
//所有版块
@$row_fid = "SELECT * FROM `forum_forum` ORDER BY `displayorder` ASC";
$stmt = $pdo->prepare($row_fid);
$stmt->execute();
$row_forum = $stmt->fetchAll(PDO::FETCH_ASSOC);
//主题分类
foreach ($row_forum as $key => $value) {
$fid = $value["fid"];
@$sql = "SELECT `typeid`,`name` FROM `forum_topic_type` WHERE `fid` = $fid";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$row_forum[$key]['list'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
print_r($row_forum);
$smarty -> assign("all_forum",$row_forum);