bmdsherman Posted September 14, 2009 Share Posted September 14, 2009 Hello, I have a mysql database that contains a list of photos, there url, and a description of people in the photo. I want also show people, (people are stored in a separate database and each person has a unique #), could I simply add a field called people and if person 1 2 and 3 where in a photo simply have 1, 2, 3 in the mysql row? How would I display something in a users profile saying "I'm in this photo, this photo and this photo?" Sorry if its hard to understand what I'm asking, I'm in a rush and will clear up my question later. Quote Link to comment https://forums.phpfreaks.com/topic/174247-database-planning/ Share on other sites More sharing options...
Mark1inLA Posted September 14, 2009 Share Posted September 14, 2009 In this situation, you have 2 entities photos and people where they'd each have an id like this: photos: id int name varchar people: id int name varchar You can add an intermediate table that associates these tables. Both ID's from each table would be the primary key: PhotosPeoples: photo_id int people_id int This way multiple photos can have multiple people. Just an FYI, storing image path names instead of the images themselves and using comma delimited columns are anti-patterns. Quote Link to comment https://forums.phpfreaks.com/topic/174247-database-planning/#findComment-918573 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.