sloppycode.net
Database access: Access
A basic example of using Access with PHP.
Home
›
Code snippets
›
PHP
›
Database access: Access
Like all PHP on sloppycode.net this example was made in PHP 3.x or 4, so unfortunately isn't guaranteed to be error free anymore.
<? // Over-ride 30 second default to 1 hour set_time_limit(21600); // Start Time echo "Started: " .date("H:i:s A") . "<br>"; // This won't work: (dsn-less) //$DSN = "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\\benchmark.mdb"; // Connect to Database using a DSN $DSN = "benchmark"; $connect = odbc_connect($DSN, "", ""); // Run query and go through all rows $SQL = "SELECT * FROM table"; $result = odbc_exec($connect, $SQL); $i = 0; while(odbc_fetch_row($result)) { // do nothing $i++; } // close the connection odbc_close($connect); // Finish time echo "Finished: " .date("H:i:s A") . "<br>"; echo $i . " records found"; ?>
{Name}
Says:
{Date}
{Text}
› Home
› C#
› Snippets
› Articles
› Tools
› Taglines
› ASP
› Dictionary Object
› FSO
› Unix cheat sheet
› Gaming
› CSS
› Yak
› Umbraco
› About
› Contact
› Privacy
› Projects
› Search
› Sitemap
Buy on Amazon
Buy on Amazon
Buy on Amazon
Buy on Amazon