title: Multiple Database Connections slow down my website PHP MySQL
body: <p>I am new and I tried to find my answer in the questions but I did not find something even close.</p>
  
  <p>I have a website that is displaying data from 6 different databases. This is the code i use to connect the databases:</p>
  
  <pre><code>&lt;?php 
  $con=mysqli_connect("server","user","password","database");
  $result = mysqli_query($con,"SELECT count(*) as new_orders FROM orders where print=0");
  while($row = mysqli_fetch_array($result)){
  echo $row['new_orders'];
  }
  mysql_close($con);
  ?&gt;
  </code></pre>
  
  <p>I used this code and only change the connection credentials for all the 6 databases since they have the same table. The problem is that I have to used the 6 connections in the same php page but every time I open my file dashboard.php, it shows all the information I need from the 6 databases but it takes around 30 seconds to load the page.</p>
  
  <p>As you can see my query is very simple, just count the orders and that's it ! ... I was researching and I found that I probably need indexes, well I create the indexes for the tables in the databases but nothing changed.</p>
  
  <p>Could you please help me with this? Any ideas of what the problem may be. This page is like the first page of my website so it is always visit and people have to wait like 30 seconds to see the page. </p>
  
  <p>Thank you for the help you can provide me</p>
  
  <p>Regards,</p>
  
  <p>Oscar Rabines </p>