View Single Post
Old 01-02-2007, 12:31 AM   #2 (permalink)
alhefner
Junior Member
 
Join Date: Dec 2006
Posts: 21
Default Re: database question

The best way is with a single table. Try something like:

table name - pm

fields:
  • msg_id auto increment
  • sender_id (id of the user that sends the message)
  • to_id (id of the user message is for)
  • parent_msg (would be the id of an original msg if this is a reply)
  • msg_text (text of the msg)

oops! I forgot the date field! I would use an int type of field to store a unix timestamp for this.

Now, you have all the information for a user mailbox! inbox, sent, etc...

Queries will be very simple this way.

Al
__________________
My outdoor blog
alhefner is offline   Reply With Quote
Sponsored Links