One other question I have in your guys code, in my example I have them read the message by the unique field called id. There is another field called userid and a user can only view the messages that they have a userid associated with that record. This is the problem because even if you increment the next link by 1 the next record might not be associated with that userid. A quick example to illustrate this:
Messageid Userid
20 2
21 3
22 2
So if user 2 would click the next link they would try and view messageid 21 but they would actually need to view messageid 22. Please let me know if anyone has a solution for this.
Thank you for your help so far.