I have two tables,
path : each
project has multiple
Now one of these
photos is the one that has to be displayed. The question is how to represent this in the database.
Earlier, I used descending order of
ID numbers and chose the latest one, but that failed and caused problems. Now I am not sure which way to go :
- Create a new table
ID(those that are to be displayed only) numbers.
The bad : too much work, as well as replicating the information that
phototable already has (
photos associated with
- Create a new binary field in the
phototable. If true, then display, else not.
The bad : Structurally does not prevent multiple
photos being marked to display. I want radio button behavior
- Create a new field in the
projecttable that stores the
phototo be displayed.
The bad : Does not ensure that the particular
photoIDis actually linked to this
project. Also does this information belong here?
- Any approach with foreign keys so that referential integrity is maintained..?
Using PHP and MySQL InnoDB database, though I'm sure it won't matter.
Which is the best way to store this info?