User:Krams036/mdb Cheatsheet

Connecting to MDB Database using PHP
 $dbName = 'C:\\Personal\\www_test\\udrive\\prod\\landing\\data\\mydb.mdb'; if (!file_exists($dbName)) { die("Could not find database file."); }else{ $db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }

Fetching Data
 $row = $db->query('SELECT * FROM tblMap WHERE recordId = \.$_GET["recId"].'\)->fetchAll(PDO::FETCH_ASSOC); $row[0]['clientName'];