Having developed such an app myself (albeit in Oracle where the wonder of 'connect by' exists.... which according to 'to-do' lists is coming for MySQL yippie!), this is what I recommend...
1- if your forum is 'threaded', i.e. a message is in response to another, you can use that linking to get your next/previous post based on post date, and the necessary 'in-reply-to-id' field. 2- if not, use a post_date field (which you should probably have anyway) and pull up the next record with post_date > {current msg post_date} in same forum, and last record by post_date < {current msg post_date} in same forum > -----Original Message----- > From: Maria Garcia Suarez [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 09, 2003 11:53 AM > To: [EMAIL PROTECTED] > Subject: How to get previous and next result > > > Hi there! > > I'm currently developing a web where we let users > create their own forums. All the messages (wherever > they are posted) are stored in the same mysql table. > > When users read a certain message I would like to > display the previous and next message in that forum. > > Since all the messages (of the different forums) are > stored in the very same table I don't find how to > guess what's the ID of the previous and next message. > > Is there any way to find those IDs? > > Thanks. > > Kisses, > Maria > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]