View Full Version : Post Count?
how can you show the post count from a certain category on another page on ipb (1.2 incase thats important)?
tbh imo no m8
02-07-2005, 07:44 PM
what you mean as in? 100 gets you anuva rank?
noo.....
i want the code (if there is one) to show how many threads have been made under a category. example on another page it could say
x Tutorials have been posted altogether.
tbh imo no m8
02-07-2005, 07:54 PM
well dont post then plz well there is an automatic one for replys i dont think there is one for ipb1.2
i still dont think you know what i mean :(
right what i want to do is on my portal i am making an 'other stats' block in it i want to be displayed how many tutorials have been posted on the forum all the tutorials are under the category 'Tutorials' i need a script which on the portal will display how many threads have been made in the category 'tutorials' so it would say:
Tutorials: x
(x also stands for the indefinate number (or something like that))
is there a code which will do this for ipb 1.2 ? :s
tbh imo no m8
02-07-2005, 08:06 PM
yea i know what you mean now i dont think there is for 1.2 but i think there is for 2.0.4
there must be a code :o i cant believe that theres a way to do it ive seen it before
tbh imo no m8
02-07-2005, 08:13 PM
on a 1.2>?
Mentor
02-07-2005, 08:13 PM
Ok, should be quite easy you just need to count the rows when a value is equal to the forum, but i dont know the forums id etc, so youd need to go in to yoru database threw phpmyadmin and take a look, as for a persifc forum the qurily would have 2 be custom
so i have to look through my mysql db's till i find the category ids? arent they displayed when you click them? and when i do find them what would i do next?
Just count how many people have posted them then keep them updated to save stress cause some people might post in a certain section and it might not be a tutorial "/
Mentor
02-07-2005, 09:03 PM
ok heres a simple thing that can do it
athogh ypu would need a database connection to your douems database
<?php
//Get all the topics where there in forum with id 5
$sql = mysql_query("SELECT tid FROM ibf_topics WHERE forum_id='5'");
//count them
$result = mysql_num_rows($sql);
//output
echo $result;
?>
Now the above will output how many topics are in the forum with the id 5, chnage the 5 in the exsample for the id of the forum you want to copyu topics in
(wrote in hurry so could be errors)
nothing at all appeared what do i need to configure from that just change forum_id to the category number?
:'( i always get ignored :@ *bump*
Mentor
02-07-2005, 09:47 PM
no to the actal number of that forum. Also you need a db connection on the page your trying to quiry from
so what i need to add
//MySQL Hostname
$hostname = 'localhost';
//MySQL Database Username
$sqlname = 'my username';
//MySQL Database Password
$sqlpass = 'password';
//MySQL Database Name
$mysqldb = 'db name';
to that code you gave me?
Mentor
02-07-2005, 10:01 PM
add this above it
<?php
$dbh = mysql_connect ("localhost", " DATABASE USER ", " DATABASE NAME ") or die ('DB error due to: ' . mysql_error());
mysql_select_db (" DATABASE NAME ");
?>
so in the end it will look like this?
<?php
$dbh = mysql_connect ("localhost", "USER_DB", "DB") or die ('DB error due to: ' . mysql_error());
mysql_select_db ("DB");
//Get all the topics where there in forum with id 5
$sql = mysql_query("SELECT tid FROM ibf_categories WHERE id='3'");
//count them
$result = mysql_num_rows($sql);
//output
echo "$result";
?>
this is what im usin now and its not workin still (i changed the DB parts though)
in phpmyadmin this is what i found in ibf_categories on the tutorial one
id position state name
3 7 1 Tutorials
Mentor
03-07-2005, 03:04 PM
OK easyer way to find out the forum is go in to the form conting the tutorials, and look at the id of it at the top, from the index.php?showforum=5 athogh what ever number u get there being the correct id of ythe forum
:( it wont work at all im rubbish at this explain it slower in like a tutorial :'(
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.