Table design...
Posted: Mon Feb 06, 2006 12:36 pm
I'm thinking of making it possible for users of my site, to add enteries of another table to their "favourites", meaning they would add the id of an entery of one database into another, which they can edit in. The question is, how should the table structure be?
I'm sharing session with PHPBB, that way users of my site only have to sign up once.
But I think I would be able add another user table with the values of their "favourites". I've been thinking about this all day, and I'm not quite sure of how the table design should be, for optimal performance.
In reality I only need 3 rows:
______________
| id | user_id | fav|
|__|_______|___|
|__|_______|___|
id being a unique id for every user, user_id being their PHPBB user id and fav as their "favourites"...
id and user_id haven't coused me trouble yet, but I simple don't know how the fav should be, because fav would containd many values, as the user adds more and more "favourites"
Example:
User x wants to add id 334 to his favs; id 334 goes into the fav row. Next he wants to add id 22 to his favs, 22 goes into the fav row.
Now the value of fav row for user x would be ... 334, 22 ???
And another thing, how would I propperly fetch those values and make them into links, pointing to their respected location?
I hope someone is able to help me, and please do ask me, if anything is unclear...I don't think it's entirely clear to myself. It's kind of hard getting my thought down into words...
I'm sharing session with PHPBB, that way users of my site only have to sign up once.
But I think I would be able add another user table with the values of their "favourites". I've been thinking about this all day, and I'm not quite sure of how the table design should be, for optimal performance.
In reality I only need 3 rows:
______________
| id | user_id | fav|
|__|_______|___|
|__|_______|___|
id being a unique id for every user, user_id being their PHPBB user id and fav as their "favourites"...
id and user_id haven't coused me trouble yet, but I simple don't know how the fav should be, because fav would containd many values, as the user adds more and more "favourites"
Example:
User x wants to add id 334 to his favs; id 334 goes into the fav row. Next he wants to add id 22 to his favs, 22 goes into the fav row.
Now the value of fav row for user x would be ... 334, 22 ???
And another thing, how would I propperly fetch those values and make them into links, pointing to their respected location?
I hope someone is able to help me, and please do ask me, if anything is unclear...I don't think it's entirely clear to myself. It's kind of hard getting my thought down into words...