Adobe DB generate html and ADODB pages and generate drop-down menu

Source: Internet
Author: User
I will not talk about the introduction of ADODB. if you are not clear about it, you can refer to the following two php tutorials: 1. introduction to ADODB and its connection to a simple mysql instance 2. summary of ADODB query statements (1 ). use ADODB to generate html // adod

I will not talk about the introduction of ADODB. if you are not clear about it, you can refer to the following two php tutorials:

1. Introduction to ADODB and its connection to a simple mysql instance

2. Summary of ADODB query statements


(1). use ADODB to generate html
// Adodb. inc. php contains the functions used by all Database classes. require_once 'must be loaded '. /adodb5/adodb. inc. php '; // load the rs2html function, which automatically generates an html table, such as require_once', for the query record '. /adodb5/tohtml. inc. php '; // The database connection is omitted. please refer to my previous article $ res = $ conn-> Execute ("select * from vol_msg"); rs2html ($ res );

Result generated by the above php code:


Require_once './adodb5/adodb. inc. php ';(2) paging using ADODB


// Load the adodb-pager.inc.php, which contains the paging method require_once '. /adodb5/adodb-pager.inc.php '; $ pager = new ADODB_Pager ($ conn, "select * from vol_msg"); $ pager-> Render (1); // Display 1 per page

The above php code running result:


GetMenu ()Generate ().(3) drop-down menu generated by ADODB


$res = $conn->Execute("select name,uid from vol_users");print $res->GetMenu('choose_name');

Note:

GetMenu ($ sN, $ selected, $ blank, $ mult, $ nm)

$ Blank (boolean): If the default initial value or boolean value is true, the drop-down option is empty.

$ Mult (boolean): whether multiple options can be selected from the drop-down menu.

$ Nm (integer): Set the attributes of multiple menu selections, that is, the default number of rows.

ADODB can also output comma-separated csv files and tab tables.

Generate csv:

Rs2csv ($ res); // you need to load require ("./adodb/toexport. inc. php ");

Generate a tab table:

Rs2tab ($ res) // Also load the toexport. inc. php file of the conversion method.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.