Fatal error: Cannot instantiate non-existent class: mysqlclass in E:\aboveroot\user\domain.com\test\postArray\regTest.php on line 5
The Problem:
Using security tips from these forums, I hid the password.inc.php file above the root. I can still connect to mySQL, so that part works. The mysqldb.class.php file I placed in an "includes" folder. It is finding the file, because I had a different error when I had a typo in the name and it was unable to find the file. But it is not finding the class I assume, thats what the error sounds like. Here is the file mysqldb.class.php
Code: Select all
<?php
class MySQLClass
{
var $dbhost;
var $dbuser;
var $dbpass;
var $dblink;
function connect($host, $user, $pass)
{
$this->dbhost = $host;
$this->dbuser = $user;
$this->dbpass = $pass;
$this->dblink = mysql_connect($this->dbhost, $this->dbuser, $this->dbpass);
}
}
?>Code: Select all
<?php
include_once('/aboveroot/user/password.inc.php');
include_once('http://www.domain.com/includes/mysqldb.class.php');
$db = new MySQLClass();
$db->connect(MYSQL_HOST, MYSQL_USERNAME, MYSQL_PASSWORD);
mysql_close();
?>Note: If I put the Class directly into the final code, without using an include statement, the file works. It is only when I remove the Class and place it in an include that it suddenly 'does not exist'. Where did I go wrong?