Inbox Functionality with MYSQL

Posted by Faisal Abid on Stack Overflow See other posts from Stack Overflow or by Faisal Abid
Published on 2010-04-11T06:40:19Z Indexed on 2010/04/11 6:43 UTC
Read the original article Hit count: 640

Filed under:

So I am writing a simple inbox private message system,

my table schema is as follows
- messageID
- message
- sender id
- receiver id
- date sent
- read ( 0 = no , 1 = yes)

now I am able to show the messages for the user by relating his userID to receiverID. However I also want to show the messages he has sent in the inbox to the user.

For example his inbox should show

Darth Vader - 3 New messages
Luke  - 0 new messages (0 because either I read all of them OR i sent him the message and he has not replied).

But what i can only come up with is

Darth Vader - 3 New messages.

Can I get any help with how I can accomplish this SQL call?

© Stack Overflow or respective owner

Related posts about mysql