欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP使用ODBC連接數(shù)據(jù)庫的方法

 更新時間:2015年07月18日 11:45:10   作者:鑒客  
這篇文章主要介紹了PHP使用ODBC連接數(shù)據(jù)庫的方法,涉及php使用ODBC操作數(shù)據(jù)庫的基本技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了PHP使用ODBC連接數(shù)據(jù)庫的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>PHP and ODBC: XHTML Example 1</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 </head>
 <body>
 <?php
  $conn = odbc_connect(
   "DRIVER={MySQL ODBC 3.51 Driver};Server=localhost;Database=phpodbcdb", 
   "username", "password");
  if (!($conn)) { 
   echo "<p>Connection to DB via ODBC failed: ";
   echo odbc_errormsg ($conn );
   echo "</p>\n";
  }
  $sql = "SELECT 1 as test";
  $rs = odbc_exec($conn,$sql);
  echo "<table><tr>";
  echo "<th>Test</th></tr>";
  while (odbc_fetch_row($rs))
  {
   $result = odbc_result($rs,"test");
   echo "<tr><td>$result</td></tr>";
  }
  odbc_close($conn);
  echo "</table>";
 ?>
 </body>
</html>

希望本文所述對大家的php程序設計有所幫助。

相關文章

最新評論