PHP使用ODBC连接数据库的方法,phpodbc连接数据库_PHP教程

WBOY
Release: 2016-07-13 09:46:19
Original
905 people have browsed it

PHP使用ODBC连接数据库的方法,phpodbc连接数据库

本文实例讲述了PHP使用ODBC连接数据库的方法。分享给大家供大家参考。具体实现方法如下:

   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 "

Connection to DB via ODBC failed: "; echo odbc_errormsg ($conn ); echo "

\n"; } $sql = "SELECT 1 as test"; $rs = odbc_exec($conn,$sql); echo ""; echo ""; while (odbc_fetch_row($rs)) { $result = odbc_result($rs,"test"); echo ""; } odbc_close($conn); echo "
Test
$result
"; ?>
Copy after login

希望本文所述对大家的php程序设计有所帮助。

www.bkjia.com true http://www.bkjia.com/PHPjc/1034538.html TechArticle PHP使用ODBC连接数据库的方法,phpodbc连接数据库 本文实例讲述了PHP使用ODBC连接数据库的方法。分享给大家供大家参考。具体实现方法如下:...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!