title: Problems connecting to mysql database in xampp
body: <p>I have this code that is supposed to connect my website to a database that i created in xampp.</p>
  
  <pre><code>&lt;?php
  
  define('DB_HOST', 'localhost');
  define('DB_NAME', 'anyons');
  define('DB_USER','root');
  define('DB_PASSWORD','');
  
  
  $field1_name=$_POST['email'];
  $field2_name=$_POST['pass'];
  $field3_name=$_POST['name'];
  $con=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD)or die("Failed to connect to 
  MySQL: " . mysql_error());
  @mysqli_select_db(DB_NAME,$con) or die( "Unable to select database");
  $query = "INSERT INTO login VALUES('$field1_name','$field2_name',
  '$field3_name')";mysql_query($query);mysql_close();
  ?&gt;
  </code></pre>
  
  <p>I get an error Unable to select database, meaning there's a broken connection somewhere. i have been trying to figure it out but i really can't. Help will be highly appreciated.</p>