Pagination | control | Show now, we can go further and show the category table so that users can view different content by selecting different categories. How can we solve this problem?
We can consider this:
1, the choice of the category also as a query
2, in order to save the page space, put the category in the Drop-down list box, while providing "all categories" item, so that users can browse all the information
So, we put the categories in the Query.inc
In addition, we put Thescript and Myconnstr, thepagesize into Function.inc, so that the page structure looks more reasonable.
Note the Getscriptname () function, which obtains the ASP's name from the file name, and the Add, delete, edit, view as the system's keyword after the filename, and is filtered, for example:
Theactionscript = Getscriptname ("sample_edit.asp")
Theactionscript value is "sample"
This allows us to change the additions and deletions of a table to a different file, for example:
list_add.asp Add records
list_delete.asp Delete
list_edite.asp modification
List_view.asp View
In the next chapter, we will use the Theactionscript, you will find that with it, many functions can be summed up, merged.
Please see sample3.asp
< a > ASP files that require paging
Sample3.asp
<!--#include file= ". /inc/functions.inc "-->
<%
'//////////////////////////////////////////////////////////
'
' Define table name
'
'//////////////////////////////////////////////////////////
Thetablename= "AddressBook"
'//////////////////////////////////////////////////////////
'
' Query criteria
'
'//////////////////////////////////////////////////////////
Thequeryfield = "FLD" & Thetablename & "_nickname" query field, full name
Thequerytitle = "nickname" Field display title
thequerytable = Table with VW & Thetablename field, full name
Thequeryclass = thetablename & "_class" category table name, remove TBL, VW prefix
Theclassid = C2int (Request ("ClassID")) ' Current category number
' If this is a query pattern, then construct a fuzzy query statement
If request ("mode") = "Query" Then
%><!--#include file= ". /inc/control/query_result.inc "--><%
Else
' Otherwise ignore
Thequerycon = "1>0"
End If
'//////////////////////////////////////////////////////////
'
' Restrictive conditions
'
'//////////////////////////////////////////////////////////
Thelimitcon = "FLD" & Thetablename & "_userid=" & Session ("UserID")
If Theclassid > 0 Then
Thelimitcon = Thelimitcon & "and fld" & Thequeryclass & "Id=" & Theclassid
End If
'//////////////////////////////////////////////////////////
'
' Construct the SQL statement
'
'//////////////////////////////////////////////////////////
Usql = "SELECT * from" & thequerytable & "where" ("& Thequerycon &") and ("& Thelimitcon & " ) "
%>
<!--#include file= ". /inc/control/navigator_init.inc "-->
<title>test</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link rel= "stylesheet" href