|
Add a new table (for example USER_MESSAGES) to your database which have only two ID fileds (USER_ID and MESSAGE_ID). Every time there's a new message you add the current user's ID and the newly created message ID to this table, thereby connecting them to each other.
You'll then be able to find all messages for a specifik user by joining tables (see the different JOIN commands in the manual if you're not familiar with it) or trace a message to the user who owns.
A simpler version (depending on who you ask I guess) would be to add a new field in the message table for the USER_ID. That means everytime a new message is created you tell it to belong to a specifik user.
I can't really tell which one of these options would be the better, regarding speed and efficiency, but I personally like the first one better.
__________________
34343639363436653237373432303635373837303635363337 34323037343638363137343263323036343639363432303739 366637353366
|