This article mainly introduces how to use PHP to connect to the Mysql database through ODBC. The principles will not be introduced here. Please test the code below directly:
Copy to ClipboardQuoted content:
[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 "< ;table>
";
echo "Test |
";
while (odbc_fetch_row($rs))
{
$result = odbc_result($rs,"test");
echo "
$result |
";
}
// Thanks for the hard work of organizing the tutorial, Do not collect VeryHuo_COM maliciously
odbc_close($conn);
echo "";
?>
http://www.bkjia.com/PHPjc/364745.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364745.htmlTechArticleThis article mainly introduces how to use PHP to connect to the Mysql database through ODBC. The principles will not be introduced here. Yes, please test the code below directly: Copy to Cl...