Hello!
I'm working on a forum right now and I want to place there numbers of threads and posts.
I'm stuck in this place:
Te result:
I displayed an array on the left and it looks like threads displays the last value of the array.
I tried to move the echo into the braces of the foreach loop
But the result is:
I tried display array outside of the foreach loop but i don't know how
-> EDIT SOLUTION <-
Ok, I've managed to do it this way:
I created a new column in znote_forum and updated it with a query:
then the echo displays:
and now everything is working out fine
I'm working on a forum right now and I want to place there numbers of threads and posts.
I'm stuck in this place:
Code:
$thr = array();
$th = mysql_select_multi("SELECT DISTINCT `forum_id` FROM `znote_forum_threads`;");
foreach ($th as $t){
$threadCount = mysql_select_multi("SELECT COUNT(`forum_id`) AS `count` FROM `znote_forum_threads` WHERE `forum_id`='". $t['forum_id'] ."';");
foreach ($threadCount as $thread) {
$thr[] = $thread['count'];
}
}
echo "<img src='layout/images/forum_new.gif'></td><td><a href='$url'><b>" . $category['name'] . "</b></a><br><small>" . $category['description'] . "</small><td><div style='text-align:center;'><small style='font-size:9px;'>Threads: ". $thread['count'] ."</small><br><small style='font-size:9px;'>Post: 23</small></div></td><td><a href='#'><b style='font-size:11px;'>Thread</b></a><small style='font-size:9px;font-weight:lighter;'> by <a href='#'>Player</a><br> 28 Date Hour</small></td></td>";
Te result:
I displayed an array on the left and it looks like threads displays the last value of the array.
I tried to move the echo into the braces of the foreach loop
But the result is:
I tried display array outside of the foreach loop but i don't know how
-> EDIT SOLUTION <-
Ok, I've managed to do it this way:
I created a new column in znote_forum and updated it with a query:
Code:
mysql_update("UPDATE `znote_forum` SET `threads`='". $thread['count'] ."' WHERE `id` = '".$th['forum_id']."';");
then the echo displays:
$category['threads']
and now everything is working out fine
Last edited: