Display an Access Database (quick method)
This is similar to the previous method but has a lot less code . This example uses the odbc_result_all() function which formats the whole of returned result set as a formatted table .
This is useful for checking that your SQl queries on your databases do what you expect them to do.
Here is the code
<?php
$odbcdsn = "sampledb";
$odbcuser = "";
$odbcpass = "";
$sqlquery = "SELECT * FROM tblsample";
if(!($odbcdb = odbc_connect($odbcdsn , $odbcuser , $odbcpass)))
die("cant open the dsn");
if(!($odbcrs = odbc_do($odbcdb , $sqlquery)))
die("cannot execute sql query");
odbc_result_all($odbcrs);
?>
And this produces the same results as before.