Jump to content

Recommended Posts

im developing a PM system between users on my forum...my question is: how do i set up a message table and system to have sent messages. right now, i just have it where you can only send messages...and you don't have a sent messages place because when its sent and the user on the receiving end deletes the message its gone from the db....so if i did have a sent messages thing, the person who received it would have the deleting power. how do i set up my table and whats some good theory behind saving a message until both users have 'deleted' it. and then ill run a cron job and check for messages where both users have chose to delete the same message. hope that make sense. thanks!

Link to comment
https://forums.phpfreaks.com/topic/159452-solved-message-system-setup/
Share on other sites

You could just do something like this:

 

CREATE TABLE messages (

    message_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

    from_id INT NOT NULL,

    to_id INT NOT NULL,

    from_deleted BIT DEFAULT 0,

    to_deleted BIT DEFAULT 0

    message_subject VARCHAR(255) DEFAULT '',

    message_content TEXT

);

 

 

Then, you would check from_deleted to see whether to show it in the outbox, and you would check to_deleted to see whether to show it in the inbox or not.

 

(You could even have a deleted section by making it a tinyint and doing something like 0: non deleted, 1: trash can, 2: really deleted.)

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.