[RESOLVED]keep getting a sql error :/
#1
I keep getting this:
Fatal error: Call to a member function query() on a non-object in /home/xxxxx/public_html/community/userbarsettings.php on line 20

Any ideas?

RESOLVED include global.php
Reply
#2
First, you're not inside a function scope so it's useless do use global $db in there.
Second, you're killing globals:
define("KILL_GLOBALS", 1);

Thus, $_GLOBAL['db'] does not exist.
[Image: logo.png]
Reply
#3
ok, so i've included global.php instead, it executes the sql fine, but for some reaon the changes dont appear in the db :/
Reply
#4
(2010-04-28, 06:46 PM)tommykent1210 Wrote: ok, that confuses me a lot Confused I have another plugin, i use kill globals AND global $db; and the sql's still work. But its not in a function XD

How on earth would I connect to db then? Include config.php?

If I remember right, that contenst (KILL_GLOBALS) tells MyBB to kill all globals but not sure.

global $db; is for functions only which is "local" so you tell $db is declared globally and you want to use its value, outside a function you're already "global" so doesn't make sense to use global $db;
[Image: logo.png]
Reply
#5
lol resolved it, included global.php, got confused entirely by an sql error then realised I was missing a comma XD
Reply
#6
But remove global $db too and kill_globals is unnecessary as well imo
[Image: logo.png]
Reply
#7
already have Smile

Thanks anyway Pirata Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)