1
I have two different banks that I make the connection as follows:
date_default_timezone_set('America/Sao_Paulo');
abstract class BancoDados
{
const host = 'localhost';
const novoweb = 'novoweb';
const WebAccount = 'Web_Account';
const Member = 'Member';
const user = 'usuario';
const password = 'senha';
static function conectarW()
{
    try 
    {
        $pdoW = new PDO("mysql:host=".self::host.";dbname=".self::novoweb.";charset=utf8", self::user, self::password);
        $pdoW->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        return $pdoW;
    } catch(PDOException $e) {
        echo 'ERROR: ' . $e->getMessage();
    }
}
static function conectarWA()
{
    try 
    {
        $pdoWA = new PDO("mysql:host=".self::host.";dbname=".self::WebAccount.";charset=utf8", self::user, self::password);
        $pdoWA->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        return $pdoWA;
    } catch(PDOException $e) {
        echo 'ERROR: ' . $e->getMessage();
    }
}
}
I have two values in the bank novoweb on the table shopweb with the columns id and nome, where the id I insert in the bank Web_Account in the Gametail table in the column ItemIdx but I don’t know how to do the INNER JOIN because I carry out the consultation so.
static function historicoshopweb($pdoWA,$id,$admin)
{
    try {
        if ($admin == 1) {
            $historico = $pdoWA->prepare("SELECT * FROM GameTail  ORDER BY RegDate DESC");
            $historico->execute();
        } else {
            $historico = $pdoWA->prepare("SELECT * FROM GameTail WHERE IdIdx = :id ORDER BY RegDate DESC");
            $historico->bindValue(":id",$id);
            $historico->execute();
        }
            $historicos = $historico->fetchAll(PDO::FETCH_OBJ);
            return $historicos;
    } catch (PDOException $e) {
        echo "ERROR: ".$e->getMessage();
    }
}
So I want instead of the ItemIdx appear the item name.
I use $pdoW or $pdoWA? it’s not clear to me.
– Everton Figueiredo
Try to make a connection without passing the "dbname" this way:
$pdoW = new PDO("mysql:host=".self::host.";charset=utf8", self::user, self::password);– NilsonUehara