Enviado em 21/01/2015 - 21:05h
Boa noite, como posso fazer uma conexão com dois bancos de dados mysql, utilizando PDO e OPP?class Conn {
private static $Host = HOST;
private static $User = USER;
private static $Pass = PASS;
private static $Db = DB;
/* @var PDO */
private static $Connect = null;
private static function Conectar(){
try{
if(self::$Connect == null):
$dsn = 'mysql:host='.self::$Host.';dbname='.self::$Db;
$options = [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
self::$Connect = new PDO($dsn, self::$User, self::$Pass, $options);
endif;
} catch (PDOException $e) {
PHPErro($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
die;
}
self::$Connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return self::$Connect;
}
public static function getConn() {
return self::Conectar();
}
}
Como escolher o melhor escalonador de CPU para melhorar o desempenho da máquina
Curiosidade sobre DOOM Guy e Isabelle de Animal Crossing
Inicializando servidor Ubuntu na AWS e rodando apache em Container
Instalando TeamViewer no Debian 12
Conheça o Octopi, outro frontend para o Pacman com acesso ao AUR (Arch Linux e derivados)
Terminal transparente no Debian 12 com interface i3wm usando Xfce4-Terminal e Compton