i dont understand error while connecting php and mysql? user denied ? plz help me out to solve. ?

Posted by user309381 on Stack Overflow See other posts from Stack Overflow or by user309381
Published on 2010-04-16T05:31:24Z Indexed on 2010/04/16 5:33 UTC
Read the original article Hit count: 265

Filed under:
|

class MySQLDatabase
{
    public $connection;
    function _construct() { $this->open_connection();}
    public function open_connection()
    {$this->connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
        if(!$this->connection){die("Database Connection Failed" . mysql_error());}
        else{$db_select = mysql_select_db(DB_NAME,$this->connection);
            if(!$db_select){die("Database Selection Failed" . mysql_error());    }
        }}
          public function close_connection({  if(isset($this->connection)){
            mysql_close($this->connection); unset($this->connection);}}
    public function query(/*$sql*/){ $sql = "SELECT*FROM users where id = 1";
        $result = mysql_query($sql); $this->confirm_query($result);
        //return $result;while( $found_user = mysql_fetch_assoc($result))
        {
         echo $found_user ['username'];
        }

    }
    private function confirm_query($result)
    {
        if(!$result)
        {
            die("The Query has problem" . mysql_error());
        }
    }

}

$database = new MySQLDatabase();
$database->open_connection();
$database->query();
$database->close_connection();

I am getting error like denied for user system@locahost(using password no).i have also other database but it runs fine and i dont also i have set the password after encountered the error what else can do to solve plz help ?>

© Stack Overflow or respective owner

Related posts about phpmyadmin

Related posts about php