MyBB Community Forums

Full Version: [RESOLVED]keep getting a sql error :/
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.
ok, so i've included global.php instead, it executes the sql fine, but for some reaon the changes dont appear in the db :/
(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;
lol resolved it, included global.php, got confused entirely by an sql error then realised I was missing a comma XD
But remove global $db too and kill_globals is unnecessary as well imo
already have Smile

Thanks anyway Pirata Smile