Friends list

Reply

Join Date: Jul 2009
Posts: 27
Reputation: Toxikr3 is an unknown quantity at this point 
Solved Threads: 0
Toxikr3 Toxikr3 is offline Offline
Light Poster

Friends list

 
0
  #1
Jul 10th, 2009
Hi guys, I am in need of a simple friends list code. I don't know how to start it, but I have gotten an idea, maybe anyone of you can help?

I have setup a database with login and password, I want to also add a Friends column. I will setup a "Profile page" soon, and from there I want a button to add that person. It simply puts the name of the person in the Friends column and adds a comma.

When reading the column it should go to a next line as soon as it sees a comma, thus separating the friends.

Any help? Or if you have a simple friends script that works and you would be generous enough to let me use it, that would be great.

-Toxikr3
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: Friends list

 
0
  #2
Jul 10th, 2009
You would need a SELECT statement in SQL to do this, the same way you inserted all of your friends to the database just ...
  1. SELECT id,firstName,lastName FROM Profiles WHERE isVisible='1'
of course you will need to change the names based on your table structure.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 5
Reputation: xide007 is an unknown quantity at this point 
Solved Threads: 0
xide007 xide007 is offline Offline
Newbie Poster

Re: Friends list

 
0
  #3
Jul 11th, 2009
I just accomplished this but with the guy above has the right idea it's all about mysql queries and narrow them down which takes time to do but worth it at the end!

I don't think anyone will share the source but then again you might just find one person who is lovely that wants to give you a piece of cake. Good luck with it, sorry this reply hasn't been useful but hope it sheds some light on the idea Got any questions I'll be gladly to help you.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 217
Reputation: mrcniceguy is an unknown quantity at this point 
Solved Threads: 4
mrcniceguy mrcniceguy is offline Offline
Posting Whiz in Training

Re: Friends list

 
0
  #4
Jul 11th, 2009
you can Also do like this
1.create a separate table call it friends with fields ,friend and username.
2.when someone is logged in and wants to add A friend he inserts
two rows.
  1. mysql_query(INSERT INTO friends (friend,username) VALUES('$friend','$username'));
  2.  
  3. mysql_query(INSERT INTO friends (friend,username) VALUES('$username','$friend'));
when displaying friends list
just like this
  1. SELECT *FROM friends WHERE username="$username";
Dont forget to include the friendsRequest table to insure that u just add someone u wish to be ur friend.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,000
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 129
ardav's Avatar
ardav ardav is offline Offline
Veteran Poster

Re: Friends list

 
0
  #5
Jul 11th, 2009
WRT your original idea, I'd advise against having a comma separated list in your friends column. This would make it difficult to search friends. You need a dedicated friends table:

friend_id (autonumber/int)
user_id (int : foreign key on user_id in user table)
friend_id (int : foreign key on user_id in user table)
status (tinyint : e.g. 0 = not accepted yet, 1= accepted, 2 = declined)

This should work with an invitation to be a friend system. Or if you just want to add (like Daniweb's system), no need for status column.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 27
Reputation: Toxikr3 is an unknown quantity at this point 
Solved Threads: 0
Toxikr3 Toxikr3 is offline Offline
Light Poster

Re: Friends list

 
0
  #6
Jul 11th, 2009
Thank you for the replys guys, it has given me an idea to work around with. I'll try it out and see if it works.

Though I am wondering how to send the confirm message to the certain person.

-Toxikr3
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC