一 代码
<?php include_once ('../adodb5/adodb.inc.php'); $conn = ADONewConnection('mysql'); $conn -> PConnect('localhost','root','root','db_database14'); $conn -> execute('set names gb2312'); $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>应用rs2html()函数直接输出返回的结果集</title> <style type="text/css"> <!-- TH { background-color:#FFFFFF; font-size: 12px; color: #FF0000; } td { background-color:#FFFFFF; font-size: 12px; color: #FF0000; } --> </style></head> <body> <?php include_once 'conn/conn.php'; //载入数据库链接文件 include_once '../adodb5/tohtml.inc.php'; //载入tohtml.inc.php文件 $rst = $conn -> execute('select * from tb_object'); //返回查询结果集 rs2html($rst,' width="350" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FF0000"',array('序号','类别','添加时间')); //输出结果集 ?> </body> </html>
二 运行结果