Issue including file in php gives error whether I include file or not
FROM
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 override BaseModel class in C: \ xampp \ htdocs \ allsides \ others \ basemodel.php on line 2
a source to share
Never, never, never use include or require. Use include_once or require_once. There are a few minor exceptions to this rule. But most of the time, when your code says include or require, change it to include_once or require_once.
(Template engines and similar code in code oddities and eval workarounds sometimes need non-_once versions, but that's not what you do.)
a source to share
Somehow you have two declarations of the "BaseModel" class. But since this only happens when you include your file, I suggest you better examine this spesific file.
Maybe the BaseModel file contains some other files that include the BaseModel again? Or maybe you are trying to declare the BaseModel class twice in the file?
NB: I would recommend that you always use include_once () or require_once () instead of include / require!
a source to share