Jump to content

[SOLVED] message system setup


dadamssg

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.)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.