PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Task Overview</title> </head> <body> <h1>Task List</h1> <?php // ODBC connection and query execution $dsn = 'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path_to_your_database.accdb;'; $conn = odbc_connect($dsn, '', ''); if (!$conn) { echo "Connection Failed: " . htmlspecialchars(odbc_error()); } else { $sql = "SELECT * FROM Tasks"; $rs = odbc_exec($conn, $sql); if (!$rs) { echo "Error in SQL: " . htmlspecialchars(odbc_errormsg()); } else { echo "<table border='1'><tr><th>TaskID</th><th>Description</th><th>Due Date</th></tr>"; while (odbc_fetch_row($rs)) { $taskid = htmlspecialchars(odbc_result($rs, "TaskID")); $desc = htmlspecialchars(odbc_result($rs, "Description")); $duedate = htmlspecialchars(odbc_result($rs, "DueDate")); echo "<tr><td>$taskid</td><td>$desc</td><td>$duedate</td></tr>"; } echo "</table>"; odbc_close($conn); } } ?> </body> </html>
Show:  
Copy Clear