Jump to content

*SOLVED* Class doesn't exist!


DarkOMEN

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.