');
');<!DOCUMENT html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style> th { background-color:#ffffcc; } th { border-top:1px solid #ccc; border-bottom:1px solid #ccc; border-left:1px solid #ccc; } td { border-bottom:1px solid #ccc; border-left:1px solid #ccc; } td.even { background-color:#fefefe; } td.odd { background-color:#fafafa; } table { width:40%; } </style> <?php $db="C:\\xampp718\\htdocs\\access\\students.mdb"; /* it is important to stress that you need to use the whole path to students.mdb Just "studnets.mdb" path will not work even though the db file located in the same directory as PHP file. Double back slash are due escape characters */ if (!file_exists($db)) { die("Could not find database file."); } else echo "File exists!"; $pdo = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db; Uid=; Pwd=password;"); $sql="select studentid, firstname, lastname, phone from students order by lastname"; $result=$pdo->query($sql); print('<table>'); print('<tr><th>ID</th><th>First Name</th><th>Last Name</th><th>Phone</th></tr>'); $c=0; while($row=$result->fetch()) { $ptid=$row[0]; $firstname=$row[1]; $lastname=$row[2]; $phone=$row[3]; if($c%2==0) print('<tr><td class="even">'. $ptid .'</td><td class="even">'. $firstname .'</td> <td class="even">'. $lastname .'</td><td class="even">'. $phone .'</td></tr>'); else print('<tr><td class="odd">'. $ptid .'</td><td class="odd">'. $firstname .'</td> <td class="odd">'. $lastname .'</td><td class="odd">'. $phone .'</td></tr>'); $c++; } print('</table>'); print('</body>'); print('</html>'); ?>