title: SQL Connection error: Connection failed: Unknown MySQL server host 'localhost:3306' (0)
body: <p>I am not sure why I am getting this connection failed error. I am sure that the sever where the database is located is "localhost:3306". I'm currently using cPanel to access myAdmin.</p>
  
  <p>My php code is</p>
  
  <pre><code>&lt;?php
  
  $server = "localhost:3306";
  $username="root";
  $password="";
  $dbname ="mommyinfo";
  
  $conn = new mysqli($server, $username, $password, $dbname);
  
  if ($conn-&gt; connect_error){
      die("Connection failed:  " . $conn-&gt;connect_error);
  }
  
  $sql = "SELECT title, dateposted FROM post";
  $result = $conn-&gt;query($sql);
  
  if($result-&gt;num_rows &gt; 0) {
      while($row = $result-&gt;fetch_assoc()) {
          echo $row["title"] . $row["dateposted"] . "&lt;br&gt;";
      }
  }else {
      echo "More posts coming soon!";
  }
  
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>At the top of PHP My Admin it says: 
  Server: localhost:3306 »Database: mommyinfo »Table: post</p>
  
  <p>My goal is to get the five most recent posts to display in a div on my website. I've looked it up and I can't seem to find an answer that fixes it. Thanks in advance!</p>