title: php my admin: no database selected
body: <p>I am trying to learn php and mysql. So i tried making a database using phpmyadmin and connect it with my php.
  Here is a simple example where I try to see if the database is working</p>
  
  <pre><code>&lt;?php
  $connection = mysql_connect("localhost","root");
  if(!$connection) {
      die("Database connection failed: " . mysql_error());
      $db_select = mysql_select_db("nameofdatabase",$connection);
      if (!$db_select) {
          die("Database selection failed:: " . mysql_error());
          }
      }
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Databases&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
  $result = mysql_query("SELECT * FROM nameofdatabasetable", $connection);
  if (!$result) {
      die("Database query failed::: " . mysql_error());
  }
  while ($row = mysql_fetch_array($result)) {
  echo $row[1];
  }
  
  ?&gt;
  
  &lt;/body&gt;
    &lt;/html&gt;
  &lt;?php
  mysql_close($connection);
  ?&gt;
  </code></pre>
  
  <p>and i get </p>
  
  <pre><code> Database query failed::: No database selected
  </code></pre>
  
  <p>which means than this part of code</p>
  
  <pre><code>&lt;?php
  $result = mysql_query("SELECT * FROM users", $connection);
  if (!$result) {
      die("Database query failed::: " . mysql_error());
  }
  while ($row = mysql_fetch_array($result)) {
  echo $row[1];
  }
  
  ?&gt;
  </code></pre>
  
  <p>is not working (i put a different number of these ":" in each if.
  Any help would be appreciated! Thank you!</p>