This article mainly introduces the function rs2html of PHP ADODB to generate HTML tables, and analyzes the relevant operating skills of PHP using the ADODB class to use the function rs2html to output the result set to generate HTML tables in the form of examples, and also attaches the usage of the error handling function errorMsg, which is required Friends can refer to
The example in this article describes the function of PHP ADODB to generate HTML table function rs2html. Share it with everyone for your reference, the details are as follows:
1. Code
adodb.inc.php can be downloaded from the official website http:// adodb.sourceforge.net/ Download.
conn.php:
PConnect('localhost','root','root','db_database14'); $conn -> execute('set names gb2312'); $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; ?>
rs2html.php:
应用rs2html()函数直接输出返回的结果集 execute('select * from tb_object'); //返回查询结果集 rs2html($rst,' width="350" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FF0000"',array('序号','类别','添加时间')); //输出结果集 ?>
2. Running results
#Attachment: ADODB error handling function
debug = true; //开启调试 $sql = 'select * form tb_object'; //sql查询语句 $rst = $conn -> execute($sql) or die($conn -> errorMsg()); //调用查询语句 ?>
##Related recommendations:
Use of
The above is the detailed content of PHP ADODB generates HTML table function rs2html function [with error handling function usage]. For more information, please follow other related articles on the PHP Chinese website!