30.05.2010, 15:01
This is better done with MySQL (its easier and faster in the longrun aswell).
You could create a users table and a friends table, which would contain symbolic links to the friends ID.
IE:
table users
username | userID | money
table friends
userID | targetID
Example implementation
table users
joe | 0 | 1000
bob | 1 | 2000
sky | 2 | 500
table friends
0 | 2
2 | 1
Therefore, Joe is friends with sky, bob is friends with sky, sky has two friends, likewise the other two only have one. This is much easier done than said in MySQL, it could be made in under an hour if you know what your doing.
You could create a users table and a friends table, which would contain symbolic links to the friends ID.
IE:
table users
username | userID | money
table friends
userID | targetID
Example implementation
table users
joe | 0 | 1000
bob | 1 | 2000
sky | 2 | 500
table friends
0 | 2
2 | 1
Therefore, Joe is friends with sky, bob is friends with sky, sky has two friends, likewise the other two only have one. This is much easier done than said in MySQL, it could be made in under an hour if you know what your doing.