When I attempt to use the problem class I get the following error:
Fatal error: Class 'database' not found in path/problem.php on line 25
I don't understand why I got this error, at the top of problem.php I require database.php. What is happening?
problem.php
<?php
require("common.php");
require("database.php");
...
?>
database.php
<?php
class database
{
...
}
?>
this is probably an include path issue. In order to fix it, in your problem.php file
do this:
echo realpath (dirname(__FILE__));
that will output something like
/var/www/html/myfilepath/
your file, problem.php will be in that dir.
now, if database.php is also in that dir, you can do this
$filepath = realpath (dirname(__FILE__));
require_once($filepath."/database.php");
if it is somewhere else you can do
require_once($filepath."/../../path/to/somewhere/else/database.php");
do you include the file?
include "database.php"; // or the path relative to database.php
class problem
{
nevermind. Maybe :the include (required) is not opening the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With