Use the function to read the data table content into a two-dimensional array dynamic SQL statement to read the number of clicks table as an example. Functionlist_hit ($ fields, $ where, $ order, $ direction, $ limit, $ conn) {if ($ fields & quot;) {$ fields & quot; hit_id, banner_id, hi // read the data table content by using the function and put it into a two-dimensional array
// Dynamic SQL statement
// Take the number of read clicks as an example.
Function list_hit ($ fields, $ where, $ order, $ direction, $ limit, $ conn)
{
If ($ fields = "") {$ fields = "hit_id, banner_id, hit_ip, hit_time ";}
If ($ order = "") {$ direction = "";}
$ SQL = "select $ fields from hit $ where $ order $ direction $ limit ";
// Echo $ SQL;
$ Res = MySQL_query ($ SQL, $ conn );
$ I = 0;
$ List_hit [$ I] ["rows"] = mysql_num_rows ($ res );
$ I ++;
While ($ rs = mysql_fetch_array ($ res ))
{
$ List_hit [$ I] ["hit_id"] = $ rs ["hit_id"];
$ List_hit [$ I] ["banner_id"] = $ rs ["banner_id"];
$ List_hit [$ I] ["hit_ip"] = $ rs ["hit_ip"];
$ List_hit [$ I] ["hit_time"] = $ rs ["hit_time"];
$ I ++;
}
Return $ list_hit;
}