This tutorial is show how to connect ms access database using PHP and how to retrive data of its table now i have ms access 2010 database in following table
Table name : result
Field names :
- indexNo
 - subjectName
 - subjectCode
 - subjectMark
 
for this if you using xampp or wampp or something please change this file for suppot .net framework
Find php.ini File
Ex: in xampp environment
C:\xampp\php
Open php.ini file using notepad
Copy and Paste following code and save
[COM_DOT_NET]
extension=php_com_dotnet.dll
then refresh the xampp
PHP and Ms Access database connection and retrive data
<?php
//Create Connection
$con = new COM("ADODB.Connection") or die("Cannot start ADODB Connection from 'database_conn.php'");
   $con->Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" . realpath("dbf/Student.accdb"));
//Retrive Data
echo " <table width='95%' border='1' align='center' cellpadding='0' cellspacing='0' bordercolor='#550055'>    <tr>
    <td width='20%' height='35' bgcolor='#550055'><p class='facTBLHeader facDean'>Subject Code</p></td>
    <td width='59%' bgcolor='#550055'><p class='facTBLHeader facDean'>Subject Name</p></td>
    <td width='21%' bgcolor='#550055'><p class='facTBLHeader facDean'>Mark</p></td>    </tr>";
//retrive result table data (specific Index No)
$index=001;
$sql3=$con->Execute("Select * from Result where( IndexNo='".$index."')");
     while(!$sql3->EOF)
     {
       $subCode=$sql3 ->Fields[2]->value;
       $subName=$sql3 ->Fields[3]->value;
       $subMark=$sql3 ->Fields[4]->value;
       echo "<tr>";
     echo "<td  height='26' style='padding-left:10px'>".$subCode."</td>";
     echo "<td height='26' style='padding-left:10px'>".$subName."</td>";
     echo "<td height='26' align='center'>".$subMark."</td>";
      echo" </tr>";
      $sql3->MoveNext();
     }
     $sql3->Close();
//retrieve all subject name, code and mark details of index no 001
If you want to get all details change SQL query Like this.$sql3=$con->Execute("Select * from Result");
About the Author

0 comments: