the method explained by Stas is the most common method used on all boards.
But if you need a more precise method, that will also require more
ressources from you server, what you can do is have a specific DB table
called "msg_read" taking 2 parameters : msg_id, user_id.
- Each time a user reads a message, you insert the pair "msg_id"/"user_id".
- Each time the user reloads a page,you do something like this :
$sql = "select msg_id from msg_read where user_id = ".addslashes($user_id);
// process $sql query
$msg_list = array();
while ( $row = getNextRow($mysqlResult)){
    array_push($msg_list, $row[0]);
}
- when displaying the list of all message you just check if the message is
in the array $msg_list
if ( in_array($currentMsg, $msg_list)){
    echo "READ";
}else{
    echo "UNREAD";
}

regards

Eric






> Just store the user's last log-in date/time either in the database or in
> cookie. On the next log-in "select * messages where creationDate >
> $userLastLoginDate" and highlight those selected. It won't work for every
> particular unread message, but I doubt if one needs to be that much
> specific.
>
> HTH, Stas
>
> ----- Original Message -----
> From: "Charlotte" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 26, 2002 1:04 PM
> Subject: [PHP] check unread messages in a forum
>
>
> > I have made a forum in PHP, and the users are logged in using cookies. I
> > want all new threads (and if there are new replies in an old thread) to
be
> > highlight or something like that.
> >
> > How do I check if a user has read a message or not?
> >
> >
> >
> > /Charlotte
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to