hai friends this is my chat messages table
can anybody provide me simple php mysqli code for deleting these two messages automaticly after 15 minutes i will tweak it later with my needs
i know simple code of msqli of deleting everything
how to delete by time please tell me that thing thanks
PHP Code:
--
-- Table structure for table `chat_messages`
--
CREATE TABLE IF NOT EXISTS `chat_messages` (
`message_id` int(11) NOT NULL AUTO_INCREMENT,
`message_user_id` int(11) NOT NULL,
`message_to_user_id` int(11) DEFAULT NULL,
`message_message` text NOT NULL,
`message_room_id` int(11) NOT NULL,
`message_time` int(11) NOT NULL,
PRIMARY KEY (`message_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `chat_messages`
--
INSERT INTO `chat_messages` (`message_id`, `message_user_id`, `message_to_user_id`, `message_message`, `message_room_id`, `message_time`) VALUES
(1, 1, 0, 'testing .smile.', 1, 1418462529),
(2, 1, 0, 're test .smile.', 1, 1418462902);
i know simple code of msqli of deleting everything
PHP Code:
$db->query("DELETE FROM chat_messages WHERE message_room_id = '$rid'");
Comment