本文实例讲述了PHP使用ODBC连接数据库的方法。分享给大家供大家参考。具体实现方法如下:
PHP;">
PHP and ODBC: XHTML Example 1
PHP
$conn = odbc_connect(
"DRIVER={MysqL ODBC 3.51 Driver};Server=localhost;Database=PHPodbcdb","username","password");
if (!($conn)) {
echo "Test
Connection to DB via ODBC Failed: "; echo odbc_errormsg ($conn ); echo "
\n"; } $sql = "SELECT 1 as test"; $rs = odbc_exec($conn,$sql); echo "