Created
January 8, 2018 04:46
-
-
Save Sivamanim/687a81e9e16f670b0100e15cb96cd1e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$db_username = ''; //username | |
$db_password = ''; //password | |
//path to database file | |
$database_path = $_SERVER["DOCUMENT_ROOT"] . "\access\accessdatabase.accdb"; | |
//check file exist before we proceed | |
if (!file_exists($database_path)) { | |
die("Access database file not found !"); | |
} | |
//create a new PDO object | |
$database = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=$database_path; Uid=$db_username; Pwd=$db_password;"); | |
$sql = "SELECT * FROM userdetails"; | |
$result = $database->query($sql); | |
while ($row = $result->fetch()) { | |
echo '<pre>'; | |
print_r($row); | |
echo '</pre>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment