Jump to content

Database Planning


bmdsherman

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.