title: Cannot use database.DB_NAME
body: <p>I'm trying to connect to the database, it is connected successfully but not able to use database. I;m very new to this concept of PHP. Please help me out and let me know if I'm going wrong somewhere</p>
  
  <pre><code>&lt;?php
      define('DB_NAME', 'bvh');
      define('DB_USER', 'root');
      define('DB_PASSWORD', '');
      define('DB_HOST', 'localhost');
  
      $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  
      if(!$link){
          die('could not connect: '.mysql_error());
      }
      echo 'Connected Successfully&lt;br&gt;';
      $db_selected = mysql_select_db(DB_NAME, $link);
  
      if(!$db_selected){
          die('Cannot use '.DB_NAME.':'. mysql_error());
      }
      $yname=$_POST['yname'];
      $faculty=$_POST['faculty'];
      $class=$_POST['class'];
      $uname=$_POST['uname'];
      $email=$_POST['email'];
      $pwd=$_POST['pwd'];
      $rpwd=$_POST['rpwd'];
  
      $sql = "INSERT INTO students (yname, faculty, class, uname, email, pwd, rpwd) VALUES('$yname', '$faculty', '$class', '$uname', '$email', '$pwd', '$rpwd')";
  
      if(!mysql_query($sql)){
          die('Error: ' .mysql_error());
      }
      mysql_close();
      ?&gt;
  </code></pre>