How do I transform mysql into pdo?

0

I have this function in mysql.

public function get_logst(){
        $this->connect_database(DAT5);
        $querygetl = mysql_query("select HeroName, ObjIdx from ObjLog where LogType = '5' and
        LogSubType = '2' and DataType = '2' order by LogSerial desc Limit 500");
        $this->__destruct();
        $this->connect_database(DAT3);
        while($arraygetl = mysql_fetch_row($querygetl)){
            $getmonster = mysql_fetch_row(mysql_query("select name from s_monster where 
            type = '$arraygetl[1]'"));
            echo '<tr><td><span class="badge bg-success">'.$arraygetl[0].'</span></td>                                  
                  <td>'.$getmonster[0].'</td></tr>';
        }
    }

And I want to turn it into pdo, I've tried it but with no success:

 $pdo = new PDO("mysql:host=localhost;charset=utf8", "root", "");

 $teste = $pdo->prepare("SELECT bd1.*,bd2.* FROM 'S_Data'.'*' as bd1 INNER JOIN 'LogDB'.'ObjLog' as bd2 where bd1.'type' = bd2.'ObjIdx'");
 $teste->execute();

 $resultados = $teste->fetchAll(PDO::FETCH_OBJ);

 var_dump($resultados);

I am conducting the query on two different banks but on the same host. The only change I also want in order to get all the fields of the S_Data tables because it contains all the items has the table s_item and s_monster , so when I put the * does not handle returns an array with 0 .

    
asked by anonymous 25.12.2017 / 15:02

0 answers