PHP通过ODBC查询记录
时间:2009-04-22 来源:hkebao
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<style type="text/css">
<!--
input { font-size:9pt;}
A:link {text-decoration: underline; font-size:9pt;color:000059}
A:visited {text-decoration: underline; font-size:9pt;color:000059}
A:active {text-decoration: none; font-size:9pt}
A:hover {text-decoration:underline;color:red}
body,table {font-size: 9pt}
tr,td{font-size:9pt}
-->
</style>
<title>注册会员列表 - 通过ODBC访问数据库演示</title>
</HEAD>
<body alink="#FF0000" link="#000099" vlink="#CC6600" topmargin="8" leftmargin="0" bgColor="#FFFFFF">
<br><br><center><font color=green size=3><b>注 册 会 员 列 表</b></font></center>
<br>
<table cellspacing=0 bordercolordark=#FFFFFF width="95%" bordercolorlight=#000000 border=1 align="center" cellpadding="2">
<tr bgcolor="#6b8ba8" style="color:FFFFFF">
<td width="5%" align="center" valign="bottom" height="19">ID</td>
<td width="10%" align="center" valign="bottom">姓名</td>
</tr>
<?php
/*1. 建立连接到ODBC*/
$conn = odbc_connect("php","root","321");
/*2. 创建SQL语句*/
$SQL = "SELECT * FROM TEST";
$result=odbc_do($conn,$SQL);
/*3. 得到返回的结果集,进行分割处理*/
while(odbc_fetch_row($result))
{
?>
<tr>
<td align="center" height="19"><?php echo odbc_result($result,1)?></td>
<td align="center"><?php echo odbc_result($result,2)?></td>
</tr>
<?php
/*4. 关闭*/
}
odbc_close($conn);
?>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<style type="text/css">
<!--
input { font-size:9pt;}
A:link {text-decoration: underline; font-size:9pt;color:000059}
A:visited {text-decoration: underline; font-size:9pt;color:000059}
A:active {text-decoration: none; font-size:9pt}
A:hover {text-decoration:underline;color:red}
body,table {font-size: 9pt}
tr,td{font-size:9pt}
-->
</style>
<title>注册会员列表 - 通过ODBC访问数据库演示</title>
</HEAD>
<body alink="#FF0000" link="#000099" vlink="#CC6600" topmargin="8" leftmargin="0" bgColor="#FFFFFF">
<br><br><center><font color=green size=3><b>注 册 会 员 列 表</b></font></center>
<br>
<table cellspacing=0 bordercolordark=#FFFFFF width="95%" bordercolorlight=#000000 border=1 align="center" cellpadding="2">
<tr bgcolor="#6b8ba8" style="color:FFFFFF">
<td width="5%" align="center" valign="bottom" height="19">ID</td>
<td width="10%" align="center" valign="bottom">姓名</td>
</tr>
<?php
/*1. 建立连接到ODBC*/
$conn = odbc_connect("php","root","321");
/*2. 创建SQL语句*/
$SQL = "SELECT * FROM TEST";
$result=odbc_do($conn,$SQL);
/*3. 得到返回的结果集,进行分割处理*/
while(odbc_fetch_row($result))
{
?>
<tr>
<td align="center" height="19"><?php echo odbc_result($result,1)?></td>
<td align="center"><?php echo odbc_result($result,2)?></td>
</tr>
<?php
/*4. 关闭*/
}
odbc_close($conn);
?>
相关阅读 更多 +