Home > Backend Development > PHP Tutorial > PHP uses ODBC to connect to Mysql database_PHP tutorial

PHP uses ODBC to connect to Mysql database_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 14:53:43
Original
1377 people have browsed it

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 ClipboardLiehuo.Net CodesQuoted 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 "";
?>

www.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...
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 Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template