未定义的变量:第14行的C:\ wamp \ www \ demo.php中的db_selected [关闭]

Im just learning about linking databases and php. I have a database called forms1 that i created with a table named "demo" in the "demo" table i have two forms, ID and input1. when I test my demo.php i get the following error,

Notice: Undefined variable: db_selected in C:\wamp\www\demo.php on line 13 Call Stack

Time Memory Function Location

1 0.0006 250416 {main}( ) ..\demo.php:0 can't useforms1:

Here is my php


    <?php
      define('DB_NAME', 'forms1');
      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());
  }
  $db_seleccted = mysql_select_db(DB_NAME, $link);
      if (!$db_selected) {
  die('can\'t use' . DB_NAME . ': ' . mysql_error());
  }
     echo 'Connected Successfully';
      mysql_close();
    ?>        

Does anyone have an idea what may be the problem?

You spelled your variable incorrectly:

$db_seleccted = mysql_select_db(DB_NAME, $link); <-- HERE

Notice the double "c". Easy fix:

$db_selected = mysql_select_db(DB_NAME, $link);