Jump to content

Archived

This topic is now archived and is closed to further replies.

DarkOMEN

*SOLVED* Class doesn't exist!

Recommended Posts

Hello everyone, sorry if this has been asked (I searched the forums for a good while), here goes:

I have a tree of require()'s that looks like the following:

index.php
system/base.php
system/class/fetchall.php
system/class/query.php

Now, in that list, the top file includes the file under it includes the file under it includes the file under it. This works fine. Now, in query.php I create a class called query. If I try to instantiate 'query' from base.php, I get the following error:

[code]Fatal error: Cannot instantiate non-existent class: query in home/johnhorn/public_html/equilibrium/system/base.php on line 35[/code]

After this didn't work, I tried the following:

In base.php:

[code]require($equilibrium_rootdir.'system/config.php');
require($equilibrium_rootdir.'system/includes/vars.php');
require($equilibrium_rootdir.'system/includes/constants.php');

require($equilibrium_rootdir.'system/class/query.php');

$query = new Query;[/code]

Same error:

[code]Fatal error: Cannot instantiate non-existent class: query in home/johnhorn/public_html/equilibrium/system/base.php on line 35[/code]

Note that the class Query is defined in query.php. I know I'm doing something PHP doesn't allow, but I'm not sure what or how I can get around this.

EDIT: I should note that all the files are being read from. I can echo data from any of them, which prints out in HTML in index.php.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.