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
https://forums.phpfreaks.com/topic/62763-solved-private-messaging-system/
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.

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.