Okay i'm creating a little community website. A user joins my site and he has the option to
enter his informations upload photos add friends and post to his wall. By now i want to know how to implement the album table.
The album has the following attributes:
albumID albumName albumCover albumDescription albumDate albumPrivacy enum userID username
Now i want to know how to link albums table with the users table. Every user has its ID and username. The usersId is primary key and the username is unique.
1 user can have many albums. 1 album can belong to only 1 user.
How can i do relationships ???
Help please because im not that good at databases and i want to get things done in optimized and secured way.
By now i use usersid and username as attributes in albums table to identify which album belongs to who. like this SELECT * FROM albums WHERE userid='$userid' AND username ='$username'
.
Where $userid is value from session variable and $username is value from session variable.