PHP ADODB generates HTML table function rs2html function [with error handling function usage]

不言
Release: 2023-03-29 18:54:02
Original
1362 people have browsed it

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;
?>
Copy after login

rs2html.php:





应用rs2html()函数直接输出返回的结果集


 execute('select * from tb_object');  //返回查询结果集
  rs2html($rst,' width="350" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FF0000"',array('序号','类别','添加时间'));  //输出结果集
?>

Copy after login

2. Running results

#Attachment: ADODB error handling function

 debug = true;  //开启调试
  $sql = 'select * form tb_object';  //sql查询语句
  $rst = $conn -> execute($sql) or die($conn -> errorMsg());    //调用查询语句
?>
Copy after login

Running results:

##Related recommendations:

Use of

ADODB

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!

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!