PHP uses ODBC to connect to the Mysql database. This article mainly introduces how to use PHP to connect to the Mysql database through ODBC. we will not introduce the principles here. please test the following code directly: copytoCl this article mainly introduces how to use PHP to connect to the Mysql database through ODBC. we will not discuss the principles here. please test the following code directly:
Copy to ClipboardReference: [www.bkjia.com]Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
PHP and ODBC: XHTML Example 1
$ 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"
| Test |
";While (odbc_fetch_row ($ rs )){$ Result = odbc_result ($ rs, "test ");Echo"
| $ Result |
";}// Do not maliciously collect VeryHuo_COMOdbc_close ($ conn );Echo"
";
?>
Using ODBC to connect to the Mysql database, I will not introduce the principles here. please test the following code: Copy to Cl...