Access denied for user ''@'localhost' (using password: NO) phpmyadmin

Wednesday, November 4, 2015

Actually I am new to php. I created login page using php .after clicking on submit button its showing




"Access denied for user ''@'localhost' (using password: NO)"




i am using amazon linux server. In that i can login with my username and password but using php script i cant connect to the my database



Here my dbconn.php scirpt



<?php

class UserValue{

private $SERVER;

private $HostName;

private $Db_UserID;

private $Db_Password;

private $Database;

function __construct($HostName, $Db_UserID, $Db_Password, $Database){

$this->HostName = '*****';

$this->Db_UserID = '****';

$this->Db_Password = '****';

$this->Database = '****';

$this->SERVER = $_SERVER[HTTP_HOST];

if ($this->SERVER !== 'www.******.com') die("Entered incurrect Hostname!!!");

$connect = mysql_connect($this->HostName, $this->Db_UserID, $this->Db_Password);

if (!$connect) die('Could Not Connect to '.$this->HostName.' throwing error'.mysql_error());

$db_conn = mysql_select_db($this->Database);

if (!$db_conn) die('Could Not Connect to '.$this->Database.' throwing error'.mysql_error());

}
}

?>


please help me how to fix this issue

0 comments:

Post a Comment