The code copy is as follows:
Rem==Previous article==
Rem====================================================================================
Rem=parameter description:
Rem=pid Current ID, prame: column is currently dropped (such as the general web_news table, the field is usually wn_**, and the rule represents wn)
Rem=ptable (table before the table. For example, the general table name is: site name_table name (shenzhe_news)ptable: means shenzhe)
Rem=Description: Using the above nomenclature can make this process common
Rem=================================================================================
FunctionGetPre(pid,prame,ptable)
id=prame&"_id"
title=prame&"_title"
table="city_"&ptable
url="show_"&ptable
sql="SelectTOP1"&id&","&title&"FROM"&table&"Where"&id&"<"&pid&"orDERBY"&id&"DESC"
setrs=Conn.Execute(sql)
Ifrs.eoforrs.bofThen
pre="Previous article:No news anymore"
Else
pre="<ahref="&url&".asp?"&id&"="&rs(0)&">"&rs(1)&"</a>""
EndIf
GetPre=pre
EndFunction
Rem=Next article
Rem===============
Rem=The meaning of the parameter is the same as before
Rem===========
FunctionGetNext(nid,nrame,ntable)
id=nrame&"_id"
title=nrame&"_title"
table="city_"&nable
url="show_"&ntable
sql="SelectTOP1"&id&","&title&"FROM"&table&"Where"&id&">"&nid&"orDERBY"&id&"""&id&"""
setrs=Conn.Execute(sql)
Ifrs.eoforrs.bofThen
nnext="Next:No news"
Else
nnext="<ahref="&url&".asp?"&id&"="&rs(0)&">Next article:"&rs(1)&"</a>"
EndIf
GetNext=nnext
EndFunction
Implementation code:
Even the database has tables:
city_activecity_datecity_note
City_active main fields are: ca_id, cd_title
City_date main fields are: cd_id, cd_title
city_note main fields are: cn_id, cn_title
This way you can quote:
Quote the previous article next article in show_note.asp?cn_id=4
<%=GetPre(cn_id,"cn","note")%>'Previous article
<%=GetNext(cn_id,"cn","note")%>'Next article