perleager has asked for the wisdom of the Perl Monks concerning the following question:

Hey, This is a question that was brought up to my attention when I successfully made this little note message system. (Message Reply Sequencing)

After I built this little note system for my users, it sent , replied, and viewed all notes fine.

But the problem I wasn't really aware of was the deletion of notes as user Coruscate brought up on the thread linked above.

If user Bob sends a note to user Tony, then the inbox would look like this:

Tony's Inbox: (click note id to read)<br><br> id creator date reply delete 1 Bob 12/30/03 [-reply button-] [--] + [-delete selected messages-]
Now lets say user Tony replies saying "hi" to Bob.

Bob's inbox would now look like this.

Bob's Inbox: (click note id to read)<br><br> id creator date reply delete 1 Bob 12/31/03 [-reply button-] [--] + [-delete selected messages-]
So lets say user Bob reads the reply from Tony and decides to delete the message, then that means Bob's INBOX should view no more messages and Tony's INBOX should still have the message from Bob because Tony did no deletion action. My problem is that once Bob deletes a message, then Tony's INBOX will also have no messages because Bob deleted the message.

If you read the thread I linked above, you can see that the database is setup with only one column to determine the status of the message, so if one user deletes a message, it'll update that column with the value of "DEL". My inbox code does not view any messages if the status value is "DEL".

I tried fixing this problem by having two status columns instead, status1, status 2. If bob deletes a message then it'll update status1 to 'del', but status2 will still be 'notread'. This solution to my problem is not working because I can not get everything to work accordingly.

Am I on the right track , or is there a better solution to this problem?

Any help is appreciated :)

Thank you,
Anthony

Replies are listed 'Best First'.
Re: Message deletion options
by daddyefsacks (Pilgrim) on Dec 31, 2003 at 06:04 UTC
    I guess this isn't really much of a Perl question at this point, maybe you would have better luck with a database design forum. With that said, not knowing much about how you decided to set up the tables, perhaps what you want is a seperate status table:
    CREATE TABLE status( user_id INT NOT NULL PRIMARY KEY, msg_id INT NOT NULL, status VARCHAR(3) NOT NULL )
    That way you could query the status table per user for messages that aren't deleted. Hope that helps.