Page 1 of 1
send messages to other users need help
Posted: Fri Jun 05, 2009 9:24 pm
by scarface222
Hey guys just wondering if anyone knows the best way to set up a system that allows users to send messages to eachother. I figured using a mysql table with the users name and 10 fields for messages but it doesn't make sense for obvious reasons. Is there a way to set it up so when a message is sent there is a spot created for it without creating a field for the entire table or a different practical way? I know this may sound dumb to some but I am rather inexperienced still so bare with me.
Re: send messages to other users need help
Posted: Fri Jun 05, 2009 9:45 pm
by requinix
Code: Select all
userid | username
-------+---------
1 | Alice
2 | Bob
3 | Cindy
4 | David
fromuser | touser | subject | message
---------+--------+-----------------------------------+-------------------------------------------------
3 | 1 | Bob | Bob's kinda cool. What's he like?
1 | 3 | Re: Bob | He's a nice guy. You should talk to him sometime
1 | 2 | Cindy | I think Cindy likes you. Invite her to dinner!
2 | 4 | What do you know about Cindy? | So I heard that Cindy's interested in me...
4 | 3 | Bob's asking about you | You like him?
3 | 4 | Re: Bob's asking about you | I dunno... maybe...
4 | 2 | Re: What do you know about Cindy? | Go for it!
2 | 3 | Hey | You busy Saturday night?
3 | 1 | Re: Bob | Alice! He asked me out!
1 | 3 | Re: Bob | Great! You'll have to tell me about it
3 | 2 | Re: Hey | Nah, I'm free. Wanna do something?
...
Re: send messages to other users need help
Posted: Fri Jun 05, 2009 9:55 pm
by scarface222
Thanks I will test it out. Just curious, when you use a primary and foreign key ie. userid it automatically links two tables? How do you set up that link using say phpmyadmin?