Hello guys,
I am kinda stuck. Please help.
I am writing a PM system.
- User can send a message to multiple users
- Inbox/Sent box Folders
Below is the schema to handle just that, but the problem is when some reply to the message Its coming in my inbox thats fine but I can’t seems to figure out is_read feature. Can you please suggest?
CREATE TABLE `private_messages` (
`msg_id` int(20) NOT NULL auto_increment,
`last_response_id` int(20) NOT NULL,
`fromuserID` int(20) NOT NULL,
`subject` varchar(200) NOT NULL,
`body` text NOT NULL,
`msg_date` datetime NOT NULL,
`is_delete` tinyint(1) NOT NULL,
PRIMARY KEY (`msg_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `private_message_recipients`
--
CREATE TABLE `private_message_recipients` (
`id` int(20) NOT NULL auto_increment,
`msg_id` int(20) NOT NULL,
`fromuserID` int(11) NOT NULL,
`touserID` int(20) NOT NULL,
`folderID` smallint(1) NOT NULL,
`is_read` tinyint(1) NOT NULL,
`is_new` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `private_message_responses`
--
CREATE TABLE `private_message_responses` (
`response_id` int(20) NOT NULL auto_increment,
`msg_id` int(20) NOT NULL,
`response` text NOT NULL,
`posterID` int(20) NOT NULL,
`response_date` datetime NOT NULL,
PRIMARY KEY (`response_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Thanks in advance