Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 12-04-2005, 09:24 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try changing to:
PHP Code:
<?php
chdir
('../forum');
include_once(
'./global.php');
global 
$vbulletin// Should not be needed
 
// get total members 
$numbersmembers=$vbulletin->db->query_first('SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "user'); 
 
...
etcreplacing $db by $vbulletin->db
Reply With Quote
  #12  
Old 12-04-2005, 05:11 PM
wii's Avatar
wii wii is offline
 
Join Date: Oct 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still the same result using this code:

PHP Code:

<?php
chdir
('../forum');
include_once(
'http://www.myforum.com/forum/global.php');

// get total members 
$numbersmembers=$vbulletin->db->query_first('SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "user'); 
$numbermembers number_format($numbersmembers['users']); 
// get total posts 
$countposts=$vbulletin->db->query_first('SELECT COUNT(*) AS " . TABLE_PREFIX . "posts FROM post'); 
$totalposts number_format($countposts['posts']); 
//$countthreads=$vbulletin->db->query_first('SELECT COUNT(*) AS " . TABLE_PREFIX . "threads FROM thread'); 
//$totalthreads = number_format($countthreads['threads']); 

echo $numbermembers " forum members - " $totalposts  " posts";

?>
I would still even pay for a working code, so I can include these stats in my website (not forum).

Thanks

Quote:
Originally Posted by wii
Anyone? I would even pay a little (using paypal) to get this done !

Thanks
Reply With Quote
  #13  
Old 12-04-2005, 06:05 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

replace:
PHP Code:
include_once('http://www.myforum.com/forum/global.php'); 
With:
PHP Code:
require_once('./global.php'); 
And with the above code, error message is the same? Even the linenumber?
Reply With Quote
  #14  
Old 12-05-2005, 05:40 AM
wii's Avatar
wii wii is offline
 
Join Date: Oct 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now I get an SQL error:

Invalid SQL:
SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "user;
Reply With Quote
  #15  
Old 12-05-2005, 05:57 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please post your current script and the full error message.
Reply With Quote
  #16  
Old 12-05-2005, 07:20 AM
wii's Avatar
wii wii is offline
 
Join Date: Oct 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, the script:

PHP Code:

<?php 
chdir
('../forum'); 
 require_once(
'./global.php');  

// get total members  
$numbersmembers=$vbulletin->db->query_first('SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "user');  
$numbermembers number_format($numbersmembers['users']);  
// get total posts  
$countposts=$vbulletin->db->query_first('SELECT COUNT(*) AS " . TABLE_PREFIX . "posts FROM post');  
$totalposts number_format($countposts['posts']);  
//$countthreads=$vbulletin->db->query_first('SELECT COUNT(*) AS " . TABLE_PREFIX . "threads FROM thread');  
//$totalthreads = number_format($countthreads['threads']);  

echo $numbermembers " forum members - " $totalposts  " posts"

?>
The error - removed link (private forum)

PHP Code:

Database error in vBulletin 3.5.1
:

Invalid SQL:
SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "user;

MySQL Error  You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near '" . TABLE_PREFIX . "user' at line 1
Error Number 
1064
Date         
MondayDecember 5th 2005 10:19:57 AM
Script       
http://www.myforum.com/beta/stats.php
Referrer     
IP Address   XX.XX.XX.XX
Username     
wii
Classname    
vB_Database 
Reply With Quote
  #17  
Old 12-05-2005, 08:40 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$numbersmembers=$vbulletin->db->query_first('SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "user'); 
replace by:
PHP Code:
$numbersmembers=$vbulletin->db->query_first("SELECT COUNT(*) AS users FROM " TABLE_PREFIX "user"); 
Do the same for the other query (SDon't use single quotes there).
Reply With Quote
  #18  
Old 12-07-2005, 11:11 AM
wii's Avatar
wii wii is offline
 
Join Date: Oct 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I got the include to work on the page, but which include is best to use for this?

include()
require()
include_once()
require_once()

I?m using require currently.

But the post count is between 10-13 more than on the forum (seems to change once in a while), anyway to fix this?

Is it possible to modify the script, so it uses the same as index.php to count the posts?

PHP Code:

 
// get total threads & posts from the forumcache 
$totalthreads 0
$totalposts 0
if (
is_array($vbulletin->forumcache)) 

    foreach (
$vbulletin->forumcache AS $forum
    { 
        
$totalthreads += $forum['threadcount']; 
        
$totalposts += $forum['replycount']; 
    } 

$totalthreads vb_number_format($totalthreads); 
$totalposts vb_number_format($totalposts); 

// get total members and newest member from template 
$numbermembers vb_number_format($vbulletin->userstats['numbermembers']); 
Reply With Quote
  #19  
Old 12-07-2005, 11:26 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

require_once is mostly the correct way.
Reply With Quote
  #20  
Old 12-07-2005, 04:27 PM
wii's Avatar
wii wii is offline
 
Join Date: Oct 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks
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 02:32 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.04695 seconds
  • Memory Usage 2,285KB
  • 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
  • (9)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete