you should have a datetime and new field. new is default to yes, but when the user views the message, you update it to no, also, you order the messages by datetime desc, that way the newest ones are on top, so when you go click next, it will see the next newest one, only the ones where new ='yes'
for example, your in message.php?id=2
function showmessage(){
message
}
function update(){
update set new = 'no' where id=$id }
function link(){
$getmess=mysql_query(select * from messages where to_user = '$ME' and new='yes' limit 1)
$messid=mysql_result($getmess, 0, 'id');
echo "<a href='message.php?id=$messid'>
}
if (isset($id)) {update(); showmessage(); link();
have link last, that way it would have been updated before you query it, or simply select the next row, 1;