This article mainly introduces how to use ODBC to connect to a database in PHP. It involves the basic skills of using ODBC to operate a database in php and has some reference value. For more information, see
This article mainly introduces how to use ODBC to connect to a database in PHP. It involves the basic skills of using ODBC to operate a database in php and has some reference value. For more information, see
This example describes how to connect PHP to a database using ODBC. Share it with you for your reference. The specific implementation method is as follows:
PHP and ODBC: XHTML Example 1 <? Php $ conn = odbc_connect ("DRIVER = {mysqlodbc 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"
Test |
"; While (odbc_fetch_row ($ rs) {$ result = odbc_result ($ rs," test "); echo"
$ Result |
";} Odbc_close ($ conn); echo"
";?>
I hope this article will help you with php programming.
,