Xtremer360 Posted March 25, 2012 Share Posted March 25, 2012 Putting together a personal message system and trying to figure out what I'm missing. I think what's confusing me is the possibility of forwards, bcc, and just responding and what not. I'm trying to cover everything on it. Full texts Field Type Null Key Default Extra id mediumint(11) NO PRI NULL auto_increment subject varchar(255) NO NULL senderID mediumint(5) NO NULL recipientID mediumint(5) NO NULL message text NO NULL dateSent datetime NO NULL dateRead datetime NO NULL messageRead tinyint(1) NO NULL messageReplied tinyint(1) NO NULL messageForwarded tinyint(1) NO NULL recipientDeleted tinyint(1) NO NULL senderDeleted tinyint(1) NO NULL Quote Link to comment Share on other sites More sharing options...
scootstah Posted March 25, 2012 Share Posted March 25, 2012 Your question is pretty similar to this one which has a good answer here, so I won't bother repeating what he said. However I have some ideas for your other problems. For forwarding, you could simply create a new message that quoted the previous one, and add "FW:" to the subject or something. You don't need to have a special flag this way, and it keeps everything simple. As far as bcc you could just create multiple messages with different recipient ID's. Quote Link to comment Share on other sites More sharing options...
cpd Posted March 25, 2012 Share Posted March 25, 2012 Or alternatively for your BCC feature you can create another table which houses a "PersonID" and a "MessageID". This is aiming more towards a normalised database unlike scootstah's suggestion of reinserting the message with a new ID. It depends how well you want your database to be structured and how picky you want to be about normalisation. Quote Link to comment Share on other sites More sharing options...
scootstah Posted March 25, 2012 Share Posted March 25, 2012 Yeah, that's probably a better idea. Quote Link to comment Share on other sites More sharing options...
cpd Posted March 25, 2012 Share Posted March 25, 2012 Moreover, you could implement a "read" field in your many-to-many table. An easily implemented feature if you go along the normalised route. Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted March 25, 2012 Author Share Posted March 25, 2012 With version 1 of my script I really want to handle as much as doing things right the first time as possible and minimizing possible errors/issues down the road. With the db table structure I have above I'm trying to figure out what data should be split. Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted March 26, 2012 Author Share Posted March 26, 2012 What I'm trying to figure out is there anything out that I should include or even think about if a message can be forwarded or not. Here's my updated structure: usersPersonalMessages Full texts Field Type Null Key Default Extra id mediumint(11) NO PRI NULL auto_increment subject varchar(255) NO NULL senderID mediumint(5) NO NULL message text NO NULL dateSent datetime NO NULL senderDeleted tinyint(1) NO NULL usersPersonalMessagesRecipients Full texts Field Type Null Key Default Extra usersPersonalMessagesID mediumint(11) NO NULL userID mediumint(5) NO NULL bcc tinyint(3) NO NULL messageRead tinyint(1) NO NULL dateRead datetime NO NULL recipientDeleted tinyint(1) NO NULL Quote Link to comment Share on other sites More sharing options...
cpd Posted March 26, 2012 Share Posted March 26, 2012 When you say "can be forwarded" do you mean in some situations it isn't possible to forward a message? Additionally, you could replace the "bcc" field with a "type" field and create a third tale with the different type ID's. E.g. 1. Message, 2. CC, 3. BCC, 4. Fwd Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.