Jump to content

[SOLVED] Private Messaging System


cmgmyr

Recommended Posts

I have a private messaging system on my site right now thats pretty simple and gets the job done. But I want to make it better and more efficient.

 

Right now I have:

CREATE TABLE `mail` (
  `mid` int(11) NOT NULL auto_increment,
  `uidto` int(11) NOT NULL default '0',
  `uidfrom` int(11) NOT NULL default '0',
  `subject` text NOT NULL,
  `message` text NOT NULL,
  `status` tinyint(1) NOT NULL default '0',
  `status2` tinyint(1) NOT NULL default '0',
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`mid`)
) ENGINE=MyISAM ;

for the database. What I'm doing is if you reply to a message it puts the last message below it and you type your new message on top

This is my reply
--------------
This is this original

so as you can imaging after a few messages back and fourth the body of the message gets pretty big.

 

What I want to do is set it up kind of like Facebook. Having parent_id's for messages and having a recursive function flip through them all in a "conversation" instead of having the whole conversation in one DB entry.

 

What do you think about doing this the new way with the recursive function? Do you forsee any problems with this? Any other ideas that you would like to pass along?

 

Thanks,

-Chris

Link to comment
Share on other sites

while not trying to make a PM system, i really liked that article about the modified preorder tree traversal design.  so much more efficient than query recursion, and it doesn't actually take THAT much to wrap your head around it.  guaranteed to make its way into my future hierarchical applications.  thanks 448191.

Link to comment
Share on other sites

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.