PDA

View Full Version : Fatal error: Call to a member function query_first_slave() on a non-object


digitalstudio
02-18-2009, 09:38 AM
Hi all.

(Using version 3.8.1)

I'm trying to write some code outside of VB. However, when i include the first VB file i get this fatal error:

Fatal error: Call to a member function query_first_slave() on a non-object in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mywebsite\forum\includ es\functions.php on line 1368


Here's the code that's throwing the fatal error:


class myclass
{
public function doSomething()
{
chdir('/path/to/forum');
require_once '/path/to/forum/global.php';
}
}


Any ideas why this is happening!?!

Thanks.

Marco van Herwaarden
02-18-2009, 10:00 AM
What is the first file you include? You must always include global.php before including any others.

digitalstudio
02-18-2009, 10:12 AM
global.php is the only file I'm including! I'm also getting two warnings before the fatal error.

Warning: array_keys() [function.array-keys]: The first argument should be an array in [path]\includes\functions.php on line 4227

Warning: Invalid argument supplied for foreach() in [path]\includes\functions.php on line 4227

Fatal error: Call to a member function query_read_slave() on a non-object in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mysite\forum\includes\ functions.php on line 3189

Marco van Herwaarden
02-18-2009, 11:29 AM
Actually looking at your code again your problem is that you are trying to use it inside a class function. This will not work.

digitalstudio
02-19-2009, 10:29 AM
OK - code moved and now it works. Thanks for the help.

Thread resolved.