title: How to connect to MySQL database in PHP using mysqli extension?
body: <p>I have code like this to connect my server database:</p>
  
  <pre><code>&lt;?php
  
  $con = mysqli_connect("", "username", "password", "databasename");
  if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  </code></pre>
  
  <p>But it displayed "Failed to connect to MySQL", what is wrong with this code? First time I am trying it in web server, whereas my localhost worked perfectly. </p>