Page 1 of 1

[solved]db connection problem

Posted: Mon Sep 15, 2008 8:09 pm
by m2babaey
i have a login script and have used it several times. but i'm unable to connect in 1 host
it is known to use PEAR in the code and the config file is:

Code: Select all

 
 
<?php
 
function handlePearError($error) {
    header('HTTP/1.0 500 Internal Server Error');
    //die("$error->message<br />$error->userinfo"); // uncomment this to debug
    die('Error ocurred, please try again later');
}
 
 
function &db_connect() {
    require_once 'DB.php';
    $dsn = "mysql://user:pass@unix+localhost/db_name";
 
    $db = DB::connect($dsn);
 
    if (DB::isError($db)) {
        die("Database connection failed.");
    }
 
    $db->setFetchMode(DB_FETCHMODE_OBJECT);
    $db->setErrorHandling(PEAR_ERROR_CALLBACK, 'handlePearError');
    
    return $db;
}
?>
 
currently i get this error:
Database connection failed.
why do you think i can't connect to database?
how can i see the error?

Re: db connection problem

Posted: Mon Sep 15, 2008 9:37 pm
by m2babaey
oh i hadn't added the user to database