• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Znote ACC] - Forum - Threads count

Manots

New Member
Joined
Apr 7, 2010
Messages
4
Reaction score
2
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:
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:
forum.jpg

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:
forum.jpg

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:

CesarZ

Active Member
Joined
Sep 20, 2012
Messages
223
Solutions
2
Reaction score
44

@Manots

hey, can you explain more on what you did exactly? I'm stuck there too
 
Top