title: Cannot connect to mysql database [phpmyadmin]
body: <ul>
  <li>to create databases I'm using xampp->phpyadmin, </li>
  <li>I have created a database called "dungeons",</li>
  <li><p>in my php code Im connecting to MySQL with this code:</p>
  
  <pre><code>if ($_SERVER["SERVER_ADDR"]=="localhost")
  {
    define("SQL_HOST","localhost");
    define("SQL_DBNAME","dungeons");
    define("SQL_USERNAME",xxx);
    define("SQL_PASSWORD",xxx);
  } else {
    define("SQL_HOST","127.0.0.1");
    define("SQL_DBNAME","dungeons");
    define("SQL_USERNAME", xxx);
    define("SQL_PASSWORD",xxx);
  }
  
  mysql_connect(SQL_HOST, SQL_USERNAME, SQL_PASSWORD) or die("Cannot connect to mySQL: " . mysql_error());
  mysql_select_db(SQL_DBNAME) or die("Cannot connect to the database: ". mysql_error()); 
  </code></pre></li>
  </ul>
  
  <p>The error message says</p>
  
  <blockquote>
    <p>Unknown database 'dungeons', when selecting db.</p>
  </blockquote>
  
  <p>I don't have any idea where the problem is, since the database is made and I have successfully connected to the mysql with the code.</p>