I made an online email system, and I want to limit the users to only 50 emails that they can store. If there mailbox already has 50 emails in it and sombody trys to send a new letter, I want to delete the oldest letter to make room for the new one. What I want to do is save the newest 50 rows and delete the rest, but I don't know how to do that. I searched on the MySQL Help forum and found a similar problem/solution. But they were saying to delete all of the rows "WHERE msgid < (lastid - 50)" but that would not work for me because there are multiple users on the same msgid.
Here is the table that stores the emails:
CREATE TABLE rl_mail
msgid INT UNSIGNED NOT NULL AUTO_INCREMENT,
fromuid INT UNSIGNED NOT NULL,
touid INT UNSIGNED NOT NULL,
date DATE NOT NULL,
time TIME NOT NULL,
viewed BOOL NOT NULL,
Need more help with your project? One of the thousands of programmers, web designers or artists at <a href="http://www.rentacode...d_6764522">Rent
A Coder</a> would be happy to help.
Disclaimer: Free advice is usually worth what you paid for it. ( or at least when it's coming from me! )