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