|
|
#1 |
|
Baseband Member
|
Good day everyone, I have a project and i need help on what approach should i do to my database, the project goes like this, It is a website in which each user will create their own profile. What should i do to my database so that the user can add another user member of the website, just like in friendster... wherein in my profile page, i can see my details, and at the right side, i can see my added friends...
Any suggestion will be highly appreciated... thank you.... by the way, i'm using html/flash/php/mysql |
|
|
|
|
|
#2 |
|
Baseband Member
|
You should have a User table, with a user ID and all the user details, then perhaps column with a comma separated list of friends user ID's, then use PHP's explode() function to create an array of friends user IDs. You could then have a foreach loop go through the array, and grab info on the friend from the User table.
Code:
foreach($friendIDs as $friendID)
{
$friendInfoResult = mysql_query("
SELECT * FROM
`Users`
WHERE
`ID` = '" . $friendID . "'
");
$friendInfo = mysql_fetch_assoc($friendInfoResult);
// Then loop get all the other fields from friendInfo[0]["thefield"]
}
__________________
Computers are like air conditioners, they break when you open windows. |
|
|
|
|
|
#3 |
|
Baseband Member
|
Yes i think its a good idea, but my concern is how many characters does the friendsID field allow? what if a user have so many friends, so the friendsID field would be like jason,mark,phillip,etc,etc,etc,etc,etc and so on...
|
|
|
|
|
|
#4 | |
|
Baseband Member
|
Quote:
Code:
SELECT * FROM `Friends` WHERE `UserID` == $TheUsersID
__________________
Computers are like air conditioners, they break when you open windows. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|