Thanks for the reply. However, that only gives me a single degree. I'm looking for the way to traverse a 'tree' to see who is in your extended networks, so I can do things like: You are 4 degrees away from Sam: You know bob who knows john who knows carrol who knows Sam. Sam <- carrol <- john <- bob <- you Etc. > -----Original Message----- > From: Micah Stevens [mailto:micah@xxxxxxxxxxxxxxxxxx] > Sent: Monday, March 06, 2006 10:28 PM > To: php-db@xxxxxxxxxxxxx > Subject: Re: Help needed creating a social network > > > CREATE TABLE `users` (userID int(11) not null auto_increment, primary > key(userID), name tinytext not null, email tinytext not null); > > CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), > key(friendID)); > > <?php > $friends = mysql_query("select users.name, users.userID from > users left join > links on links.friendID = users.userID where links.userID = > {$_GET['userID']}"); > > echo "<h1>You have friends!!</h1>"; > while ($f = mysql_fetch_assoc($friends)) { > echo "<a > href='socialnetwork.php?userID={$f['userID']}'>{$f['name']}</a > ><br>\n"; > } > > publish(); > profit($greatly); > do (!$use) { > coldfusion('Cause it sucks'); > } > ?> > > (har har) > > > > > > > > On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: > > Anyone have some pointers at a HowTo on creating a social network? > > > > Basically I need to show people in your immediate network, > and also friends > > of your friends, etc... Like the whole 'six degrees of > separation' thing. > > Ala: myspace, friendster, etc. ad nauseum. > > > > I prefer mySQL and PHP, but I could port from most any > code. I guess I'm > > mostly interested in the theory of this an how do I set up > the tables > > properly and what is the magic incantation (JOIN) to get > this "chain" of > > people. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php