Jump to content

Private Message System


bam2550

Recommended Posts

I made a Simple Login System. Now i want people to be able to privately communicate with one another (similar to a forum PM system). One thing i am not sure is how to store the message in MySQL and how to make sure the right person requests it from MySQL...

 

I am not really sure how to go about this. Googling has not really helped :-\

 

If anyone could help me out, or atleast point me into the right direction that would be  awesome!

 

Thank you :)

Link to comment
Share on other sites

`private_messages`

 

id (INT)    |    userid (INT)    |    author (INT)    |    time_stamp (INT)    |    message (TEXT)    |
========================================================================================================
1                    2                     5                 1128793540               hey you...

 

Would be a simplified way of doing it.

Link to comment
Share on other sites

depends on how advance the pm box should be

 

the db shud be something like

id integer // msg id

from_user integer // author id

to_user intger // reciepient id

sent timestamp // when it was sent

status enum // (new,read)

msg text // the msg itself

 

than to check a users msg, check i the to_user field.

u can check the to_user field with the status field to show if they have new msgs waiting in their inbox

 

etc etc etc

 

Link to comment
Share on other sites

Just think of how the system shud work for u.

 

 

user1 writes a message -> user2 recieves a msg from user1

 

so for the basics u need

from_id

to_id

msg_text

 

now u want to add more features.

like the date is was sent.

than maybe the status of the msg (unread/read) so user can have a notice on the index instead of checking the inbox everytime.

 

maybe a mass mail system, or mail to a group of users etc etc etc.

 

Just begin with the basics, and work up and add on to it

Link to comment
Share on other sites

you mean

 

 

SELECT * FROM table WHERE to='$username'

 

since if it is asking from = username then it will get all the things that you sent...

 

that would be good for the sent box, but not for this one :)

 

and that is all? i dont understand what you meant i didnt define from rows :\

 

Link to comment
Share on other sites

ohkay thanks yeah.

 

Now is that all of it? Ill try this one more time!

 

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /opt/lampp/htdocs/test/inbox.php on line 16

 

thats the error i get.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.