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 09:38 PM

Which forum? whats the id??? The above code could easily be modified to only show one

09-08-2000 09:41 PM

Quote:

Originally posted by TechTalk
Which forum? whats the id??? The above code could easily be modified to only show one
The forum ID i am trying to post the total threads for is: 20

09-08-2000 09:43 PM

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 WHERE forumid=20 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> has<b>$latest_array[threadcount]</b> threads</FONT><BR>";
}
?>


09-08-2000 09:46 PM

Whenever you need me to bow down and kiss your feet in public, let me know!! :cool:

09-08-2000 09:47 PM

Quote:

Originally posted by Zothip
Whenever you need me to bow down and kiss your feet in public, let me know!! :cool:
LOL! Heres an update version for you:

Code:

<?php
require("/full/path/to/forums/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);
if (isset($forumid)==0 or $forumid=="") {
$query = "SELECT forumid,title,threadcount FROM forum ORDER BY title ASC";
}else  {
$query = "SELECT forumid,title,threadcount FROM forum WHERE forumid=$forumid";
}
$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>";
}
?>

Just call it like this:
http://www.extremeforums.com/include....php?forumid=2

~Chris

09-08-2000 10:27 PM

What was wrong with my code? It did exactly what you needed :)

09-08-2000 11:01 PM

:)

09-09-2000 11:27 AM

I think a little feet kissing is deserved ;)

Anyway - selecting all the the forumid's and then doing a myqsl_num_rows on it is going to be more accurate then selecting the threadcoutn thing, which is the main difference between the two versions.

You are only selecting numbers as well, so even if you have alot of threads it isn't going to be server intensive.

I like to try to make everything accurate, so I would do it that way :)

09-10-2000 07:06 PM

Quote:

Originally posted by Michael
I think a little feet kissing is deserved ;)

Anyway - selecting all the the forumid's and then doing a myqsl_num_rows on it is going to be more accurate then selecting the threadcoutn thing, which is the main difference between the two versions.

You are only selecting numbers as well, so even if you have alot of threads it isn't going to be server intensive.

I like to try to make everything accurate, so I would do it that way :)

Hes trying to get the total number of threads in a particular forum.........so getting the value from the "threadcount" field is most accurate because it tells you exactly how many threads are in that forum

Just my $0.02

~Chris

09-10-2000 08:58 PM

But threadcount is incremented everytime something is posted, but if there was an error in MySQL and some information was deleted then threadcount would be inaccurate. If you wanted to delete a post through PhpMyAdmin then threadcount would be wrong.

Using a field that is incremented to keep count isn't very accurate.


All times are GMT. The time now is 05:44 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.01233 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
  • (2)bbcode_code_printable
  • (3)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