Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2005, 03:29 PM
Slapyo Slapyo is offline
 
Join Date: Feb 2004
Location: Rancho Cucamonga
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default What querys for # of threads and posts?

I want to put the number of threads and posts on the front of my site. I currently have something, but the numbers are off. I assume that it is because of deleted posts and threads. Below are the queries I am using.
Code:
SELECT COUNT(*) AS threads FROM thread
SELECT COUNT(*) AS posts FROM post
However, the numbers are off. On my homepage it shows:
Threads: 477
Posts: 1,531

But on the forum index page at the bottom it shows:
Threads: 463
Posts: 1,529

What are the queries that vBulletin uses to grab that information? I have been digging through the code but I can't seem to find them. I would like the numbers to match.
Reply With Quote
  #2  
Old 03-09-2005, 03:33 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Slapyo
I want to put the number of threads and posts on the front of my site. I currently have something, but the numbers are off. I assume that it is because of deleted posts and threads. Below are the queries I am using.
Code:
SELECT COUNT(*) AS threads FROM thread
SELECT COUNT(*) AS posts FROM post
However, the numbers are off. On my homepage it shows:
Threads: 477
Posts: 1,531

But on the forum index page at the bottom it shows:
Threads: 463
Posts: 1,529

What are the queries that vBulletin uses to grab that information? I have been digging through the code but I can't seem to find them. I would like the numbers to match.
Don't forget you need to exlucde delete posts
Reply With Quote
  #3  
Old 03-09-2005, 03:35 PM
Slapyo Slapyo is offline
 
Join Date: Feb 2004
Location: Rancho Cucamonga
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ya, I am just not sure how to do that in the query.
Reply With Quote
  #4  
Old 03-09-2005, 03:43 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Slapyo
Ya, I am just not sure how to do that in the query.
Take a look near the bottom of index.php
Reply With Quote
  #5  
Old 03-09-2005, 03:47 PM
Slapyo Slapyo is offline
 
Join Date: Feb 2004
Location: Rancho Cucamonga
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great. thanks. i will look there.

ok, so the bottom of index.php had exactly what i want. the # of threads, the # of pots, and the # of users. however, i copy/paste that code into my homepage and it all comes up as 0.

i did print_r on the array and it was full of information, except it didn't have the thread or post info in it like the code says it should.

here is what the top of my file looks like.

PHP Code:
<?php
    
require_once("header.inc.php");
    
chdir("./forums/");
    require_once(
"./global.php");
    require_once(
"./includes/functions_forumlist.php");
    
chdir("../");
    require_once(
"latest_users.inc.php");
    require_once(
"online.php");

    
// Forum Stats

    
$countmembers $DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
    
$totalmembers vb_number_format($countmembers['users']);

//    echo "<pre>";
//    print_r($forumcache);
//    echo "</pre>";

    
$totalthreads 0;
    
$totalposts 0;
    if (
is_array($forumcache))
    {
        foreach (
$forumcache AS $forum)
        {
            
$totalthreads += $forum['threadcount'];
            
$totalposts += $forum['replycount'];
        }
    }
    
$totalthreads vb_number_format($totalthreads);
    
$totalposts vb_number_format($totalposts);
before that it worked, the variable names are the same. i am not sure why the array contains that information in the forums, but not when i call it outside of the forums.

still no dice. i have looked at the different files that are included. on index.php and i have the same files included on my page. but the array on my page still doesn't contain the information that is on the index.php page.

ok, so after digging through the code and seeing the query that gathers the info and stores it into an array, i ran the query myself and parsed it. still no dice. i end up with 0. it seems like the information being stored in the database doesn't contain the information. however the code on index.php says otherwise. so i am confused.
Reply With Quote
  #6  
Old 03-10-2005, 03:54 PM
Slapyo Slapyo is offline
 
Join Date: Feb 2004
Location: Rancho Cucamonga
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery
Take a look near the bottom of index.php
Can't seem to get it to work. That code doesn't work when I put it on my page, even though the same files are included in index.php as on my page.
Reply With Quote
  #7  
Old 03-11-2005, 07:49 PM
Slapyo Slapyo is offline
 
Join Date: Feb 2004
Location: Rancho Cucamonga
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i found out the solution. if anyone wants to know it is in my last post in this thread.

https://vborg.vbsupport.ru/showthread.php?t=77916
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:34 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.07337 seconds
  • Memory Usage 2,232KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete