views:

274

answers:

5

With

include('basemodel.php');

I get

Fatal error: Class 'BaseModel' not found in C:\xampp\htdocs\allsides\account\model.php on line 2

Without

include('basemodel.php');

I get

Fatal error: Cannot redeclare class BaseModel in C:\xampp\htdocs\allsides\others\basemodel.php on line 2

A: 

Try:

require_once ("basemodel.php");

===

Edit: wait -- what other files are you including?

Jeffrey Berthiaume
In the same file, $resourcelcs.'/model.php'.
Delirium tremens
A: 

To me the error says exactly what it says!

What happens if you rename the C:\xampp\htdocs\allsides\others\basemodel.php to C:\xampp\htdocs\allsides\others\basemodel1.php (including the class definition)

Looks like you have two files with the same classname.

Wayne
this is really weird... I don't have two files with the same classname... I have many extends... is that it?
Delirium tremens
Well, it looks like PHP is complaining that the object BaseModel already exists and was defined in others\basemodel.php. require_once may work, but it sounds like you have an underlying problem that should be addressed.
Wayne
and AccountView is created the same way, maybe even twice you know, but I can't access it lol
Delirium tremens
A: 

Somehow you have two declarations of the class "BaseModel". But since this only happens when you include your file, i suggest you to take a better look into that spesific file.

Maybe the BaseModel-file includes some other files, which again includes BaseModel? Or maybe you actually tries to declare the class BaseModel two times in the file?

NB: I would recommend you to always use include_once() or require_once() instead of include/require!

qualbeen
A: 

APC (the caching engine) does this to me sometimes. If you're using it, try clearing the opcode cache:

apc_clear_cache("user"); // user cache
apc_clear_cache(); // system cache
Adam Backstrom
A: 

Never, never, ever use include or require. Use include_once or require_once. There are a few small exceptions to this rule. But for the most part where ever your code says include or require, change it to include_once or require_once.

(Template engines and similar code within code oddities and workarounds for eval sometimes need the non-_once versions. But this not what you are doing.)

jmucchiello