Jump to content


Photo

*SOLVED* Class doesn't exist!


  • Please log in to reply
1 reply to this topic

#1 DarkOMEN

DarkOMEN
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 April 2006 - 04:23 AM

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:

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

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

In base.php:

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;

Same error:

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

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.

#2 DarkOMEN

DarkOMEN
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 April 2006 - 07:42 AM

Just posting to mention I solved this on my own.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users