Two databases with PHP PDO?

2

I'm trying to make a connection to two databases with PDO ta like this.

Config.php

<?php
  class config{
  var $host = 'meuhost';
  var $usuario = 'meuusuario';
  var $senha = 'minhasenha';
  var $db = 'banco1','banco2';

  }
?>

And where I'm doing the class is like this.

<?php

   include_once 'config.php';

    class conecta extends config
    {
        var $pdo;

        function __construct()
        {
             $this->pdo = new PDO('mysql:host='.
                $this->host.';dbname='.
                $this->db, $this->usuario, $this->senha); 
        }
     }
?>

I just do not know how to do the construct function connect to both banks only with banco1 .

    
asked by anonymous 15.11.2017 / 17:47

0 answers