Database Connection Problem
Posted: Thu Jun 14, 2007 9:50 am
I'm using a config.php file which i use in my database class to change the values however this warning...
Thanks
makes be believe that the functions are not picking up the values in teh config file. Could someone explain if i am not doing something right?Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/creative/public_html/demo1/classes/database.class.php on line 16
Thanks
Code: Select all
<?php
require ('./../config.php');
class database
{
function databaseConnection()
{
global $dbhost, $dbusername, $dbpassword,$default_dbname;
$link_id = '';
$link_id = mysql_pconnect($dbhost,$dbusername,$dbpassword);
if (!$link_id){
$MYSQL_ERRNO = 0;
$MYSQL_ERROR = "Connection Failed to the host".$dbhost."";
return 0;
}
else if (!mysql_select_db($default_dbname)){
$MYSQL_ERRNO = mysql_errno();
$MYSQL_ERROR = mysql_error();
return 0;
}
}
}
?>Code: Select all
<?php
ob_start();
session_start();
// The $siteURL is the full URL of where the current site is...
$site = 'demo1';
// Database username, host, password and name
$default_dbname = '*****';
$dbhost = 'localhost';
$dbusername = '*****';
$dbpassword = '*****';
?>