简体   繁体   中英

How do I join tables from two different PDO object?

I don't know how must i do to join tables from two different PDO object. I hope all of you can help me to solve this problem. I really thanks for your respons.

$dbsql = new PDO('mysql:host=localhost;dbname=dbpenggajian', $user='root', $pass='');

$dbaccess = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=D:\\Kepegawaian Arto Moro\BACK_UP_ABSENSI\TJ_Main_Data.mdb; Uid=userName;Pwd=everyday;");

and this is my experiment code

$acc=$dbaccess+$dbsql->query("SELECT *
                    FROM dbaccess.HR_Personnel as h
                    RIGHT JOIN dbaccess.TA_Record_Info a
                    ON h.ID=a.Per_ID
                    INNER JOIN dbsql.pegawai_tetap as p
                    on h.Per_Code=p.nip ;");
    while($k=$acc->fetch(PDO::FETCH_ASSOC)){

but still error

Fatal error: Call to a member function fetch() on a non-object

please help me. thanks

That's impossible, of course.

You have to import your ODBC table in mysql first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM