friend system
Posted: Wed Dec 29, 2010 1:09 pm
i'm trying to create a friend system for my website, and when ever you click a users name where ever it might appear, it will take you to my user.php page. now in that page i'm currently trying to display all of the person's friend's ids that are stored like this:1,2,3,4 in a text value in my users data base called friends. now i'm trying to get the value to the page, turn it to an array, and diplay it in seperate links using the array() and the implode() function. but i'm unsuccessfully. if any1 could pliz help me, here is my code:
user.php
output

user.php
Code: Select all
<html>
<head>
<link rel='stylesheet' rel='text\css' href='forum/fstyle.css'>
</head>
<body link="#990000" vlink="#CC0000">
<table BACKGROUND="images/pnl.png">
<center><h1> Profile </h1></center><div id='holder'>
<div id='profile'>
<?php
include "connect.php";
$id = $_GET['user_id'];
$selid = $id - 5;
$sid = $id + 2;
$get = "SELECT * FROM users WHERE id='$selid'";
$query = mysql_query($get)or die(mysql_error());
$array = mysql_fetch_array($query)or die(mysql_error());
$friends = $array['friends'];
$name = $array['name'];
$image = $array['picid'];
$posts = $array['posts'];
$date = $array['date'];
$title = $array['title'];
$rank = $array['rank'];
$size = 500;
$hide = md5(rand(9999999,0));
$fary = array($friends);
$frnds = implode('<br/>',$fary);
echo "<br/><img class='floatright' src='$image' alt='' width='$size' height='$size'>";
echo "<big>Name: $name</big><br/>";
echo "<big>Posts: $posts</big><br/>";
echo "<big>Joined at: $date</big><br/>";
echo "<big>Title: $title</big><br/>";
echo "<big>Rank: $rank <a href='add_freind.php?user_id=$sid'>add as a friend</a></big><br/>";
echo "<big>Friends:</big> <p><a href='user.php?user_id=$sid&$hide'>".$frnds."</a><br/>";
?>
</div></div>
</table>
</body>
</html>