musicradiolive Posted August 17, 2007 Share Posted August 17, 2007 Hi All,I need a bit of help with some code.Brief:On the homepage of my site i have got 2 sections, 1 shows the latest news and the other will show the latest forum posts.I use Snitz for forums and KustomPage for Content Management System.The news one i have done without any problems, but the forums one i am having a few problems with.HERE IS THE CODE I USE FOR THE NEWS (SUPPLIED BY KUSTOM PAGE BUT TWEAKED BY ME) <% strSQL = "Select * FROM tblNews ORDER BY tblNews.pDate DESC" rs.Open strSQL, strCon for i = 1 to newsItems if not rs.eof then dim desc, tmp 'desc = removeHTML(desc) desc = left(rs("Text"), newsDesc)%><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333" bgcolor="#CCCCCC"> <tr> <td class="newsdate"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="left"><font class="newsdate"><% =rs("pDate") %></span></div></td> </tr> <tr> <td><img src="/images/trans.gif" width="1" height="2" /></td> </tr> <tr> <td><div align="left"><span class="newsquick"><% =Desc %></span></div></td> </tr> <tr> <td><img src="/images/trans.gif" width="1" height="2" /></td> </tr> <tr> <td><div align="right" class="readfull"><a class="readfull" href="?Page=News&Title=<% =server.urlEncode(rs("Title")) %>">Read Full Story</a></div></td> </tr> </table> </td> </tr> </table> <% rs.movenext desc = "" if i < newsItems then if not rs.eof then response.write("<img src=/images/trans.gif height=3 width=1>") end if else end if nextrs.close%> Now, for the forums i want to display the items in a similiar way.For each one (it will show the last 5) i want it to do this:> SUBJECT (linked through to view the full post) [T_SUBJECT]Posted by USERNAME - DATE AND TIME [T_LAST_POSTER] [T_LAST_POST]The problem i face with this is that the topics and usernames are in 2 seperate tables.From FORUM_TOPICS i need to pull:T_SUBJECT - Subject of the postT_LAST_POSTER - The last poster in the topicT_LAST_POST - The date of the last postThe last poste field just uses a number which is the ID Number of the user. From FORUM_MEMBERS i need to pull:MEMBER_ID - ID Number of the userM_USERNAME - Username of the userAny help is really appreciated.ThanksJon Link to comment Share on other sites More sharing options...
jesh Posted August 17, 2007 Share Posted August 17, 2007 Are you looking for a SQL query?If you are usign SQL Server, you might try something like this: SELECT TOP(5) t.T_SUBJECT AS Subject, t.T_LAST_POST AS Date, m.M_USERNAME AS UsernameFROM FORUM_TOPICS t INNER JOIN FORUM_MEMBERS m ON t.T_LAST_POSTER = m.MEMBER_IDORDER BY t.T_LAST_POST DESC Link to comment Share on other sites More sharing options...
musicradiolive Posted August 17, 2007 Author Share Posted August 17, 2007 I use an access database. Link to comment Share on other sites More sharing options...
Synook Posted August 20, 2007 Share Posted August 20, 2007 You can still run SQL queries on an Access database, but I would suggest shifting to SQL, even MS SQL, as Access tends to crash when many people (i.e. more than 10) try to access it at once. So, just use the Open method to query your database using the previously suggested query. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.