hi,
i have a database class file.
<?php
class Database
{
private static $instance = null;
private $dbUser = DBUSER;
private $dbPass = DBPASS;
private $dbName = DBNAME;
private $dbHost = DBHOST;
private $dbConn = null;
public static function getInstance()
{
if (!self::$instance instanceof self)
{ self::$instance = new self;
}
return self::$instance;
}
private function __construct()
{
global $lang;
$this->dbConn = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
mysql_select_db($this->dbName, $this->dbConn);
}
}
Database::getInstance();
?>
this function is in another file, common.php:
function mysqlPresent($tablename)
{
$result = mysql_query("DESCRIBE `$tablename`");
}
In this file index.php, i include the
- database class file
- and common.php file
i tried to call the mysqlPresent() function in this file and it gave me an error: "Access denied for user ''@'localhost' (using password: NO)".
I thought that if i had included the database file, i shouldn't be receiving this error, isn't it? Which part have i done wrong? Pls advise, thanks.