I want to join three tables from two different databases(ms.access and mysql) but i have error
Fatal error: Call to a member function fetch() on a non-object in C:\xampp\htdocs\job\system\hrd\view_absensi.php on line 69
This is my code
<?php include"koneksi.php";
$sql=$dbsql+$dbaccess->query(" attach database dbsql.db as db1
attach database dbaccess.db as db2
SELECT * p.nip,p.nama,abs.Date_Time
FROM
$db1.HR_Personnel as pabs
JOIN $db1.TA_Record_Info AS abs ON abs.Per_ID = pabs.ID
JOIN $db2.pegawai_tetap AS p ON p.nip = pabs.Per_Code");
while($p=$sql->fetch(PDO::FETCH_ASSOC)){
and this koneksi.php
<?php
try{
$dbsql = new PDO('mysql:host=localhost;dbname=dbpenggajian', $user='root', $pass='');
}
catch(PDOException $e){
echo $e->getMessage();
}
try{
$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;");
}
catch(PDOException $e){
echo $e->getMessage();
}
?>
how to solve this problem? thanks for the advice