vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Tiny error, need urgent fix :D (https://vborg.vbsupport.ru/showthread.php?t=66321)

Mijae 06-19-2004 10:32 PM

Tiny error, need urgent fix :D
 
I currently have

Code:

<?php
error_reporting(7);
require('http://xxx/forum/global.php');

$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);

// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);

$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']);
?>

And I get this:

Code:

Fatal error: Call to a member function on a non-object in /home/xxx/public_html/test.php on line 5
How can I make it work? Without using templates :D

Please someone help, it used to be so easy with vB2, and now I cant make it work.

Zachery 06-19-2004 11:02 PM

Well, your trying to use this on vB3? alot of things as changed

global must be refrecned on the server, not as an outside source

Try
PHP Code:

<?php 
error_reporting
(E_ALL & ~E_NOTICE);
require_once(
"./global.php");

$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user'); 
$numbermembers=number_format($numbersmembers['users']); 

// get total posts 
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post'); 
$totalposts=number_format($countposts['posts']); 

$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread'); 
$totalthreads=number_format($countthreads['threads']);
?>

If global.php isnt in the same directory, use

Try
PHP Code:

<?php 
chdir
("./forums");
error_reporting(E_ALL & ~E_NOTICE);
require_once(
"./global.php");

$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user'); 
$numbermembers=number_format($numbersmembers['users']); 

// get total posts 
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post'); 
$totalposts=number_format($countposts['posts']); 

$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread'); 
$totalthreads=number_format($countthreads['threads']);
?>


Mijae 06-19-2004 11:11 PM

Thanks! It works.

Altho, it gives me a different total post count that the one shown on my forum's index.

What could that be due to?

Zachery 06-19-2004 11:12 PM

Because the total posts / thread count is done logicaly, not from a stright query.

Mijae 06-19-2004 11:19 PM

But which one is correct? And how can I make them both the same?

ZACH! Where are you! Someone tell me how I can make the numbers on both pages match :P

Mijae 06-20-2004 04:31 PM

Bump!

Mijae 06-21-2004 10:41 PM

Ill keep bumping till someone helps :P


All times are GMT. The time now is 02:38 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.01095 seconds
  • Memory Usage 1,731KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete