Это то, на что в настоящее время выглядят мои форумы:
http://prntscr.com/73oicl
Но, как вы можете видеть, категории говорят, что «сообщество», которое не должно произойти. Знайте, в чем проблема, но я не знаю, как это исправить. < /p>
function getForums($id) {
$currentHost = "http://$_SERVER[HTTP_HOST]";
$query = "SELECT * FROM forums, categories";
try {
global $db;
$stmt = $db->prepare($query);
$stmt->execute();
$result = $stmt->fetchAll();
foreach($result as $row) {
$category_title = $row['category_title'];
$forum_id = $row['forum_id'];
$forum_title = $row['forum_title'];
$forum_topic_count = $row['forum_topic_count'];
$forum_post_count = $row['forum_post_count'];
$forum_last_topic_id = $row['forum_last_topic_id'];
$forum_last_topic = $row['forum_last_topic'];
$forum_last_date = $row['forum_last_date'];
$forum_last_user = $row['forum_last_user'];
$fixed_last_topic = substr($forum_last_topic,0,25).'...';
echo '
'.$category_title.'
'.$forum_title.'
'.$forum_topic_count.'
'.$forum_post_count.'
'.$fixed_last_topic.' by '.$forum_last_user.' at '.$forum_last_date.'
';
}
}
catch(PDOException $ex) {
die("error");
}
}
< /code>
Как вы можете видеть, для каждого результата он собирается создавать совершенно новый Div Forum, что означает, что все подкатегории, которые даны для этой категории, не будут вместе, и каждая подкатегория собирается сделать новый форум, который я не хочу.>
Подробнее здесь: https://stackoverflow.com/questions/301 ... h-category