PHP/MySQL Database/odbc connect
odbc_connect(): establish a connection.
<source lang="html4strict">
Its syntax is:int odbc_connect (string data_source, string username, string password [,int cursor_type]) There are four possible values for the optional parameter cursor_type: SQL_CUR_USE_IF_NEEDED SQL_CUR_USE_ODBC SQL_CUR_USE_DRIVER SQL_CUR_DEFAULT
<? odbc_connect("myAccessDB", "user", "secret") or die("Could not connect to ODBC database"); ?>
</source>
Using PHP"s ODBC functions to interface with MS Access
<source lang="html4strict">
<? $connect = odbc_connect("ContactDB","","") or die("Couldn"t connect to datasource."); $query = "SELECT First_Name, Last_Name, Cell_Phone, Email FROM Contacts"; $result = odbc_prepare($connect,$query); odbc_execute($result); odbc_result_all($result,"border=1"); odbc_free_result($result); odbc_close($connect); ?>
</source>