PDA

View Full Version : Pooo... php troubles...


gengar003
05-02-2003, 10:10 PM
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:

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

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....


$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