title: PHP can't find mySQL database
body: <p>I've got the following markup and PHP. It's for a gallery - to upload and display images. I followed through <a href="https://www.youtube.com/watch?v=XxmQ-qMuMTk" rel="nofollow">this</a> tutorial, but for some reason the mysqli_connect_db can't find the DB. what am I missing?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  include('upload.php');
  ?&gt;
  
  &lt;form action="index.php" method="POST" enctype="multipart/form-data"&gt;
  
  Choose File: &lt;input type="file" name="file"&gt;
  Title: &lt;input type="text" name="nam"&gt;
  &lt;input type="submit" name="submit"&gt;
  
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and the PHP:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  $con = mysqli_connect("localhost","Melvin","") or die ("could not connect to DB");
  mysqli_select_db($con, "galerie") or die ("no database");
  
  if(isset($_POST['submit'])){
  
  $name = $_FILES['file']['name'];
  $tmp_name = $_FILES['file']['tmp_name'];
  $location = 'uploads/';
  $target = 'uploads/' .$name;
  
   if(move_uploaded_file($tmp_name,$location.$name)){
    
    echo "file uploaded";
    
    $nam = $_POST['nam'];
    $query = mysqli_query($con , "INSERT INTO images(img_name,img_title)VALUES('".$target."','$nam')");
    
   } else {
    
    echo "file not uploaded";
     
   }
  
  }
  
  $result = mysqli_query($con, "SELECT FROM images");
  while($row = mysqli_fetch_array($result)){
   
   echo "&lt;img src=".$row['img_name']." &amp;nbsp; class='addClass'&gt;";
    
  }
  
  ?&gt;</code></pre>
  </div>
  </div>
  </p>