I'm looking for a way to implement sending private messages (more like personal messages) through my website. I really just want a way for a user to view all messages sent to him/her and also view new messages.
I'm posting in the database forum because I'm planning on doing this with mysql, but I'm really asking if this is the best way to do it or if I should find some non-database way to do things.
My plan was to make a table with 5 fields: ID (ID of the actual message), from_user (ID of the user who sent), to_user (ID of the recipient), message, and date. Since my login script already saves the last login, it would be easy to check for new messages against that date. Saving both the sender and recipient ID numbers seems to be the easiest way to find all sent messages or all received messages.
So the question here is, is this a practical way to do things or would I be wasting a ton of space or should I stop trying to do this in mysql altogether and do things differently (any suggestions for different implementations would be welcome)?
I'm not looking for anyone to do this for me, just for someone more knowledgeable than myself to tell me if I'm doing this wrong.
Any help is appreciated.