I have latest posts being displayed on my front page at:
http://www.cdnauto.org
It is working fine, however, it only shows topics that are posted and not replied to. I want it to be able to show latest topic whether it has been to replied to or not. Also hyperlink to the topic does not work. Thank you in advance. Here is the code:
<%
Dim rsLastestPosts
Dim strPosts
Dim adoCon
Dim strCon
Dim strSQL
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath("/forum/XXXX/XXXXXXX.XXX")
'Set an active connection to the Connection object
adoCon.Open strCon
Set rsLastestPosts = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Top 3 tblTopic.*, tblForum.* "
strSQL = strSQL & "FROM tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID "
strSQL = strSQL & "WHERE ((tblForum.Password) Is Null) and Start_date = Last_entry_date "
strSQL = strSQL & "ORDER BY tblTopic.Last_entry_date DESC;"
rsLastestPosts.Open strSQL, strCon
If rsLastestPosts.EOF Then Response.Write "Ingen nye indlęg"
Do while NOT rsLastestPosts.EOF
If len(rsLastestPosts("Subject"))>14 then
strPosts = left(rsLastestPosts("Subject"),14) & "... "
Else
strPosts = rsLastestPosts("Subject")
End If
%>
<br>
<a href="forum_posts.asp?TID=<% = rsLastestPosts("Topic_ID") %>" target="_self">
<% = strPosts %>
<br>
</a>
<%
rsLastestPosts.MoveNext
Loop
rsLastestPosts.Close
Set rsLastestPosts = Nothing
adoCon.Close
Set adoCon = Nothing
Set strCon = Nothing
%>