[SOLVED] Fatal error: Class not found

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Defkon1
Forum Newbie
Posts: 19
Joined: Thu Aug 09, 2007 9:13 am

[SOLVED] Fatal error: Class not found

Post by Defkon1 »

i've included some classes in a script (as posted here), but when i try to instantiate an object from one of them i receive this error...

Code: Select all

include ('./class/algoritmogenetico.php');

$obj = new AlgoritmoGenetico();
:( what's wrong?
Last edited by Defkon1 on Fri Aug 17, 2007 5:19 am, edited 2 times in total.
Defkon1
Forum Newbie
Posts: 19
Joined: Thu Aug 09, 2007 9:13 am

Post by Defkon1 »

sorry, i'm an idiot.

a bad path in the include function... i've used a require instead of a include to find the error.

:oops: :oops: :oops: :oops: :oops:



please close this topic and bury me under six feet of asp code lines... :oops:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Change your "include" to "require" and post any changes to the error message please ;)

Always use "require" for class files since require causes fatal errors if the file isn't there, whereas include doesn't.
Defkon1
Forum Newbie
Posts: 19
Joined: Thu Aug 09, 2007 9:13 am

Post by Defkon1 »

thanks d11wtg... i was overconfident on that path... :oops:
Post Reply