Kenny Pollock
Mar 27 2006, 02:31 PM
Sorry to keep asking questions... I'm just looking for answers.
Friends table
User_id, friend_id
If user ID 2 adds friend 3, I want friend 3 to be asked if they want to add friend 2.
I can't think of a simple solution to this...although I'm sure the solution is simple.
Thanks again guys!
Starnox
Mar 27 2006, 03:12 PM
Just add an extra column 'validated', or an non-validated table and a validated table. Then if user ID = {your_id} and validated = 0 then ask the question. If they accept change it to 1 or something, if they don't delete it.
Brendon Koz
Mar 27 2006, 09:15 PM
Hmmm, that works. I just realized that what I was thinking, if user_id 2 said "no", it would keep asking.
Kenny Pollock
Mar 28 2006, 01:56 AM
Wouldn't that just be a waste of space in the database?
I mean, I have a feeling it can be done with a query or two, I just don't know the right query.
malikyte: If a user said no, it would be deleted from the database, therefore not asked again.
princetontiger
Mar 28 2006, 02:25 AM
Have a separate table for validated... sort of like a payment. And you can keep if you want for user history or whatnot. So, if there is a new order made to add another user to a user's buddy list, it will be marked as pending and await approval. Keep in mind, you'll be using a join.
Kenny Pollock
Mar 28 2006, 02:30 AM
Is that really the most effecient thing though?
The way I keep looking at my situation is, have a query like SELECT * FROM friends WHERE friend_id = $logged_in_guys_id AND WHERE user_id does not have a friend with the id that added you.
princetontiger
Mar 28 2006, 03:03 AM
Not sure if it's the most efficient, but it can be the most efficient if you implement it properly. I believe it is, though. You could see how the buddy list works on some other forums and whether or not they use their own table... I don't normally look at other code, though - so I can't tell you.
Brendon Koz
Mar 28 2006, 06:14 AM
Kenny, the reason I said what I said was because I was basically thinking along the same lines as you, except...how would you tell if friend #2 denied the ability to add #1 to their list? You couldn't..
...you could add a field to the lookup table, something like "reciprocal_view", meaning the other person saw they were added. Set it to 0 (or null, or "no/n" for enum) and upon viewing it (and/or deciding on a path), it'll be changed to something else so they won't see the message again, and they can either add that person or not.
That's a bit wordy and oddly stated, if you want me to explain it a bit clearer, lemme know.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.