potsandpeaks
03-13-2009, 11:35 AM
I have a new little script I am trying out that gives me an error upon initial upload.
Here is error:
Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'root'@'localhost' (using password: NO) in /home/residua5/public_html/coaching/sys/db.class.php on line 110
Can't go on, DB not initialized.
I realize from searching other posts I do not have access at root level. But I am not familiar enough with this code (I usually do this with a basic config file) to call up a database when their is no user config file to edit for database name, user name, etc.
Where do I insert the code in the script below? I do not see space to define the database name even?
Am I just too far over my head here, or am I missing something simple?
Here is the code around which the error points to....
Thanks in advance for any help.
tim
class db {
var $host;
var $username;
var $pass;
var $dbname;
var $connect_on;
var $debug;
var $q_total;
var $q_select;
function db ( $host = 'localhost', $username = 'root' , $pass = '' , $debug = '0' ) {
$this->host=$host;
$this->username=$username;
$this->pass=$pass;
$this->connect_on=-1;
$this->debug=$debug;
$this->q_total=0;
$this->q_select=0;
}
function connect ($db) {
if ( !mysql_pconnect ($this->host,$this->username,$this->pass) ) return 0;
else $this->connect_on=0;
if ( !@mysql_select_db($db) ) {
if ( $this->debug ) echo "Can't select db $db ...";
} else $this->connect_on=1;
}
Here is error:
Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'root'@'localhost' (using password: NO) in /home/residua5/public_html/coaching/sys/db.class.php on line 110
Can't go on, DB not initialized.
I realize from searching other posts I do not have access at root level. But I am not familiar enough with this code (I usually do this with a basic config file) to call up a database when their is no user config file to edit for database name, user name, etc.
Where do I insert the code in the script below? I do not see space to define the database name even?
Am I just too far over my head here, or am I missing something simple?
Here is the code around which the error points to....
Thanks in advance for any help.
tim
class db {
var $host;
var $username;
var $pass;
var $dbname;
var $connect_on;
var $debug;
var $q_total;
var $q_select;
function db ( $host = 'localhost', $username = 'root' , $pass = '' , $debug = '0' ) {
$this->host=$host;
$this->username=$username;
$this->pass=$pass;
$this->connect_on=-1;
$this->debug=$debug;
$this->q_total=0;
$this->q_select=0;
}
function connect ($db) {
if ( !mysql_pconnect ($this->host,$this->username,$this->pass) ) return 0;
else $this->connect_on=0;
if ( !@mysql_select_db($db) ) {
if ( $this->debug ) echo "Can't select db $db ...";
} else $this->connect_on=1;
}