PHP/MySQL Database/odbc connect
Версия от 10:37, 26 мая 2010; (обсуждение)
odbc_connect(): establish a connection.
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");
?>
Using PHP"s ODBC functions to interface with MS Access
<?
$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);
?>