vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Can anyone tell me... (https://vborg.vbsupport.ru/showthread.php?t=3028)

09-08-2000 08:58 PM

Um...

Wouldn't you just have to get the forumid, then just do something simple like.

<?php

$query = "select forumid from thread where forumid='theforumidyouchose'";

$result = mysql_query($query);

$num_rows = mysql_num_rows($result);

print "There are $num_rows results in that forum";

?>

Keep it simple, thats the way to do it I think.

09-08-2000 09:04 PM

Quote:

Originally posted by Chris Schreiber
Code:

$query = "select * from thread";
This must be very resource intensive though.... you are reading all of your threads simply to find out how many there are. I think you would be better off with something like this:
Code:

SELECT COUNT(*) FROM thread
HTH.

-Chris

[Edited by Chris Schreiber on 09-08-2000 at 04:58 PM]

Not 100% sure, but shouldt that be something more like:
Code:

$query=mysql_query("SELECT COUNT(threadid) AS totalthreads FROM thread");


Then you could just grab the total threads by doing something like:
Code:

$row=mysql_fetch_array($query);
$totalthreads = $row[totalthreads];
echo "$totalthreads total threads";


???

I didnt think of this the first time, because im not very knowledgable on server load / mysql strain.....etc... So i guess i really didnt care :D

~Chris

09-08-2000 09:14 PM

<?php

require("forum/admin/config.php3");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query=mysql_query("SELECT COUNT(threadid) AS totalthreads FROM thread");
$row=mysql_fetch_array($query);
$totalthreads = $row[totalthreads];
echo "$totalthreads total threads";

?>

That code shows the total number of posts on the board, not in a specific forum.

09-08-2000 09:16 PM

FORUM LIST W/ TOTAL THREADS ON NON VB PAGE

http://www.extremeforums.com/include..._count.inc.php

Usage:
Code:

include("/full/path/to/forumlist_with_count.inc.php");
forumlist_with_count.inc.php

Code:

<?php
require("/full/path/to/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);
$query = "SELECT forumid,title,threadcount FROM forum ORDER BY title ASC";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica, sans-serif\">&nbsp;°
<A HREF=\"http://www.extremeforums.com/forums/forumdisplay.php?forumid=$latest_array[forumid]\">$latest_array[title]</A> Currently <b>$latest_array[threadcount]</b> threads</FONT><BR>";
}
?>

HTH

~Chris

09-08-2000 09:16 PM

Oh yeah,

In my one I left out the MySQL connect code. You'll have to connect to the MySQL and choose the database that vBulletin is in.

09-08-2000 09:17 PM

Its killing me how a person can ask a question and people can take is so far off topic, and get so turned around

:mad:

09-08-2000 09:18 PM

Quote:

Originally posted by Zothip
<?php

require("forum/admin/config.php3");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query=mysql_query("SELECT COUNT(threadid) AS totalthreads FROM thread");
$row=mysql_fetch_array($query);
$totalthreads = $row[totalthreads];
echo "$totalthreads total threads";

?>

That code shows the total number of posts on the board, not in a specific forum.


Read this thread a little closer, im not even the one who posted that code

09-08-2000 09:26 PM

Roger, I stand corrected. You were correcting someone elses code that had nothing to do with what i asked about in the first place :)

09-08-2000 09:33 PM

Quote:

Originally posted by Zothip
Roger, I stand corrected. You were correcting someone elses code that had nothing to do with what i asked about in the first place :)



No problem.....so is the code I gave on the last page what you wanted?

~Chris

09-08-2000 09:37 PM

Quote:

Originally posted by TechTalk

No problem.....so is the code I gave on the last page what you wanted?

~Chris [/B]
No, it isnt. I am looking to display the total threads in one forum only. (ie. <A HREF="forumdisplay.php3?forumid=$forum">$forumtitl e</A> has $numberthreads Threads.)

-Thomas


All times are GMT. The time now is 06:21 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01258 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete