1

I've been trying to connect to access using php, but a connection error keep appearing. The code is:

<?php

function ConnectToDatabase()
{
    $connectionstring = 'odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\\xampp\\htdocs\\Assignment5\\Data\\assignment5.mdb';
    $dbHandle =new PDO($connectionstring);
    $dbHandle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    return $dbHandle;
}

?>

The error is:

Fatal error: in C:\xampp\htdocs\Assignment5\connection.php on line 6

I have already enabled the extension in php.ini, but it still does not work.

3
  • 3
    What's the rest of the error? Commented Aug 10, 2017 at 20:34
  • 1
    @aynber You have to guess it! Commented Aug 10, 2017 at 20:36
  • Possible duplicate of PHP and Microsoft Access database - Connection and CRUD Commented Aug 10, 2017 at 21:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.