Connect PHP with MS-Access

Asked

Viewed 182 times

1

I am trying to connect my Access database with PHP, but it is not finding the way. I didn’t want to put the path related to HD because I host my page on a host (it uses Linux) and so I wanted to put the path related to the page itself.

My code went like this:

// Add arquivo e a extensão 
$database_name = $_SERVER["DOCUMENT_ROOT"] . "_assets\db.accdb"; 
// Verifica se o arquivo existe.
if (!file_exists($database_name )) {
    die("Não foi possível encontrar o arquivo.");
}
  • Which path it has to do to the server folder?

  • I don’t know, because the page is hosted on a free host. In the example I took it referred to c:/.. /.. /.. /.. /db.accdb

  • it is important to know the directory where you will stay to get the doc

  • is hosted... will stay in html folder

  • only with this code a person can not know everything, for seeing this seems well but can also be bad

1 answer

0

Go a bar between the $_SERVER and the file:

$_SERVER["DOCUMENT_ROOT"] . "\_assets\db.accdb"; 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.