无法连接到MySQL数据库但能够连接到数据库服务器

I am trying to build a dynamic website for connecting pages with database I used the code as follows. connection with server is Ok but unable to select database. data base name, user id, password, ip of host all gave but not working. please help....

define('DB_NAME', ''); 
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '');

$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

    if (!$link) {
     die('Could not connect: ' . mysql_error());
         }
else {
      echo 'connected to server..................';   }


$db_selected = mysql_select_db($DB_NAME, $link);

if ($db_selected) {

print "Database Found";

}
else {

print "Database NOT Found";

}

Mysql has been deprecated and will eventually be removed. Consider using PDO or MySqli.

Here is a link to the PHP documentation page for making connections to a database using MySqli.

http://php.net/manual/en/mysqli.quickstart.connections.php

If you follow the instructions carefully you 'should' be able to connect. If not, perhaps you can post the error message you receive.

Try to give proper credential to connect to mysql server. mysqli_connect("localhost","root","password","db_name");