startbar
07-14-2004, 07:51 PM
hi if you use a database for an faq section like this:
<%if pageView="" THEN
dim ordervariable, sortorder
ordervariable = "DateAdded" 'default column to sort on
sortorder = "ASC" 'default sortorder
if (len(request.querystring("sortby")) >= 1) then
ordervariable = request.querystring("sortby")
end if
if (len(request.querystring("sortorder")) >= 1) then
sortorder = request.querystring("sortorder")
end if
strSQL="SELECT * FROM FAQ WHERE Status=1 ORDER BY " & ordervariable & " " & sortorder
' Open the Database
objRS.Open strSQL, objConn, adOpenKeyset, adLockPessimistic, adCmdText
IF NOT objRS.EOF THEN
'objRS.Filter=objRS("Status")=1
%>
<table><tr><td>
<%
' Write out the list of articles but it will
' only show the ones that have a status of
' 1 which shows they are online
DO WHILE NOT objRS.EOF%>
<img src="q.gif"> <a href="default.asp?view=Display&ID=<%=objRS("ID")%>" class="faqq"><%=objRS("Question")%></a> by <%=objRS("Admin")%> on <%=objRS("DateAdded")%><BR>
<%=objRS("Short")%> <a href="default.asp?view=Display&ID=<%=objRS("ID")%>" class="more">read more..</a><BR>
<img src="/Images/under2.gif"> <img src="/Images/under2.gif"> <img src="/Images/under2.gif"> <img src="/Images/under2.gif">
<BR><BR>
<%
objRS.MoveNext
Loop
objRS.Close
%>
</td></tr></table>
How do you create another section to only show the latest 5 faq's? (on the same page)
thanks
<%if pageView="" THEN
dim ordervariable, sortorder
ordervariable = "DateAdded" 'default column to sort on
sortorder = "ASC" 'default sortorder
if (len(request.querystring("sortby")) >= 1) then
ordervariable = request.querystring("sortby")
end if
if (len(request.querystring("sortorder")) >= 1) then
sortorder = request.querystring("sortorder")
end if
strSQL="SELECT * FROM FAQ WHERE Status=1 ORDER BY " & ordervariable & " " & sortorder
' Open the Database
objRS.Open strSQL, objConn, adOpenKeyset, adLockPessimistic, adCmdText
IF NOT objRS.EOF THEN
'objRS.Filter=objRS("Status")=1
%>
<table><tr><td>
<%
' Write out the list of articles but it will
' only show the ones that have a status of
' 1 which shows they are online
DO WHILE NOT objRS.EOF%>
<img src="q.gif"> <a href="default.asp?view=Display&ID=<%=objRS("ID")%>" class="faqq"><%=objRS("Question")%></a> by <%=objRS("Admin")%> on <%=objRS("DateAdded")%><BR>
<%=objRS("Short")%> <a href="default.asp?view=Display&ID=<%=objRS("ID")%>" class="more">read more..</a><BR>
<img src="/Images/under2.gif"> <img src="/Images/under2.gif"> <img src="/Images/under2.gif"> <img src="/Images/under2.gif">
<BR><BR>
<%
objRS.MoveNext
Loop
objRS.Close
%>
</td></tr></table>
How do you create another section to only show the latest 5 faq's? (on the same page)
thanks