vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Pooo... php troubles... (https://vborg.vbsupport.ru/showthread.php?t=52493)

gengar003 05-02-2003 10:10 PM

Pooo... php troubles...
 
Fatal error: Call to a member function on a non-object in /home/pgsforum/public_html/vb/showthread.php on line 14

i get that when I go to showthread.

I'm trying to put a piece of code in showthread.php to check the user's points (from lesane store hack)...

I put it at the top, above
// ################################################## ##########################
// ############################# SHOW POST ####################################
// ################################################## ##########################

and it gives me the error... why is that? Also, where would I put a code if i wanted it to execute BEFORE any posts where shown?

filburt1 05-02-2003 10:19 PM

When in doubt, remember:
PHP Code:

global $DB_site


gengar003 05-02-2003 10:43 PM

[noob]

soo... what's that mean?

[still noob]

Boofo 05-02-2003 10:52 PM

That mean you need to add $DB_site to the global line that is above the code you have added. ;)

gengar003 05-02-2003 11:12 PM

didn't work.. still get the same error... here's the top part of my showthread.php...

PHP Code:


<?php

error_reporting
(7);

$action $HTTP_GET_VARS['action'];
$goto $HTTP_GET_VARS['goto'];

if ( isset(
$goto) and ($goto=='lastpost' or $goto=='newpost')) {
  
$noheader=1;
}
/// this is where my stuff begins... added dbsite...
global $DB_site;
$userstuff $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
// there's more after this....

did i put global $DB_site in the right place?

also, i'm trying to use the eval.... etc.. gettemplate command a few lines below that.... would that cause problems? Also, it sez the error is on line 14, here's my line 14....

PHP Code:

$userstuff $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]"); 

additionally, when i put this underneat the "showthread" bunch of "/'s" and "#"'s, it works fine...

filburt1 05-02-2003 11:14 PM

Add that code after require("./global.php"); you won't need the global line for that, either, in that context.

Boofo 05-02-2003 11:14 PM

Add $bbuserinfo to the global statement also.

gengar003 05-02-2003 11:15 PM

soo... does it matter if the only "require(./global.php)" is halfway down the page?

Boofo 05-02-2003 11:22 PM

It has to be above your code.

gengar003 05-02-2003 11:47 PM

Lol, thanx, that got rid of the error, but my code still doesn't workk... but that's my problem


Thanks again ;)


Gengar out


All times are GMT. The time now is 10:04 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.01156 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete