title: Multiple mysqli database connections, bad practice?
body: <p>I currently have two databases on the same server, but with different users and would like to select data from both on the same page(s).</p>
  
  <p>I have my own database class for queries etc.. and the construct function looks similar to:</p>
  
  <pre><code>$this-&gt;connection1 = new mysqli('localhost', 'username', 'password', 'database');
  $this-&gt;connection2 = new mysqli('localhost', 'username2', 'password2', 'database2');
  </code></pre>
  
  <p>On my query function, there is an variable that allows you to query connection2 instead of connection1 e.g.</p>
  
  <pre><code>switch( $database ) {
      default:
          $this-&gt;connection1-&gt;query( $querystr);
      break;
      case 'connection2';
          $this-&gt;connection2-&gt;query( $querystr);
      break;
  }
  </code></pre>
  
  <p>Is this method bad practice or is it perfectly fine?</p>