用户'db_name'@'localhost'拒绝访问(使用密码:NO)

I have created a site that is working fine on localhost, but when i uploaded it on server its giving me the following error message.

Access denied for user 'azher94_ivsapps'@'localhost' (using password: YES) 

There are my setting for database connection

    $database=          "db_name";
    $server =           "";
    $username=          "db_username";
    $password=          "db_password";



    if(mysql_connect($server, $username, $password) && mysql_select_db($database))
    //if( mysqli_connect($server, $username, $password , $database) )

    {
        echo "connected";
    }

else

{
 echo mysql_error();
}

Kindly guide me what i am doing wrong here.

Thanks

For password you are using $password and after that you are using $Password with capital P. Please change it to $password.

First of all you need to define the localhost and one more thing you are doing wrong is you are not calling the variable properly. Use the code below

$database=          "db_name";
    $server =           "localhost";
    $username=          "db_username";
    $password=          "db_password";



    if(mysql_connect($server, $username, $password,$database) )
    //if( mysqli_connect($server, $username, $password , $database) )

    {
        echo "connected";
    }

else

{
 echo mysql_error();
}

Hope this helps you

Try with this code it will work

$con=mysqli_connect("localhost","root","your password");

mysqli_select_db("your_db",$con);