title: phpmyadmin: Connection failed: Unknown database.
body: <p>I'm a beginner and a teacher trying to make a quiz and connect to the database. I'm using MAMP 7.0.6, also installed XAMPP on my window. I had a database called "students" on phpmyadmin and a script like this: </p>
  
  <pre><code>  &lt;?php
  $servername = "localhost";
  $username = "root";
  $password = "";
  $dbname = "students";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  
  // Check connection
  if ($conn-&gt;connect_error) {
  die("Connection failed: " . $conn-&gt;connect_error);
  } 
  echo "Connected successfully";
  ?&gt;
  </code></pre>
  
  <p>It works fine when I tried to connect to the database without the $dbname, however, when I included that it says "Connection failed: Unknown database 'students'". I'm sure the name and username, password and stuff is correct, even though I don't know why the password has to be "" instead of the one shown on my phpmyadmin, but it works so I'll just leave it for later unless some of you would like to spend the time to explain it to me. 
  I just want to make this work asap coz it has been bugging me for a few days and I still can't find the solution online. I need to get the quiz done by mid August so thank you so much in advance!!!!</p>