[own plugin] call to a member function of a non-object

Discover FAST, a records keeping server control script with a public records system called Dedimania, which will show records from the server on tm-exchange.com

Moderators: Slig, TM-Patrol

Post Reply
djbacon
pedestrian
pedestrian
Posts: 9
Joined: 23 Sep 2009 09:45
Owned TM-games: TMU,TMN
Location: Latvia
Contact:

[own plugin] call to a member function of a non-object

Post by djbacon » 11 Jul 2014 13:09

Hello!

I'm creating my own plugins and some of them use classes. The problem is that it doesnt find the class i include. For example. I have "class.txsplayers.php", "common.php" and "plugin.20.txs_players.php" in same ("custom") folder. When plugin is registered i include "require_once('common.php');" that has line "require_once('class.txsplayers.php'); $txs_players = new txs_players();". Same goes for "class.db.php".
In "class.txsplayers.php" i have function that requires db. I place "globals $db;" at the beginning of function. I get error "Call to a member function query() of a non-object ...". I placed line that prints out $db methods and it shows all of them as it should, but for some reason next line $db->query("bla bla") gives me error i mentioned.
Does anyone have any idea what could be the problem?

I hope i described everything understandable. :)

Thanks in advance.

djbacon
pedestrian
pedestrian
Posts: 9
Joined: 23 Sep 2009 09:45
Owned TM-games: TMU,TMN
Location: Latvia
Contact:

Re: [own plugin] call to a member function of a non-object

Post by djbacon » 12 Jul 2014 09:07

A little additional info tha might be important.
I use Ubuntu 12.04, TM2 and FAST4.

Post Reply