I think you are using PHP. I used access 2007 file as database. I'm working on Windows XP with XAMPP's apache server. Create your database file and try this : 1. First enter to --> Control Panel > Administartive Tools > Data Sources(ODBC) > System DSN > Add.. > Microsoft Access Driver(*.mdb,*.accdb) and show your access file. Give name to the connection. 2. Then write in your .php file this code: <?php $host= "Name_You_gave_to_connection"; $user= ""; $pass= ""; $db=odbc_connect($host,$user,$pass); //connect to access file as database
if (!$db) //In case if you didn't connect , you'll get an error message { echo "Can't connect"; exit; }
Comments
1. First enter to --> Control Panel > Administartive Tools > Data Sources(ODBC) > System DSN > Add.. > Microsoft Access Driver(*.mdb,*.accdb) and show your access file. Give name to the connection.
2. Then write in your .php file this code:
<?php
$host= "Name_You_gave_to_connection";
$user= "";
$pass= "";
$db=odbc_connect($host,$user,$pass); //connect to access file as database
if (!$db) //In case if you didn't connect , you'll get an error message
{
echo "Can't connect";
exit;
}
$query = "SELECT * FROM table_name";
$row = odbc_exec($db, $query);
while(odbc_fetch_row($row)
{
$row1 = odbc_result($row,1);
$row2 = odbc_result($row,2);
$row3 = odbc_result($row,3);
echo $row1." ".$row2." ".$row3."<br>";
}
?>