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.