Question about setting up multiple relations
| From: | Monty | Date: | Thu, 28 Feb 2002 07:21:19 +0000 |
| Subject: | Question about setting up multiple relations | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-17352@lists.php.net to get a copy of this message | ||
Hi,
I have an Image table in a MySQL database that will be used to store the
location of all images used on my site. Some images will relate to an
Article table (article.id) and some images may relate to a Member table
(member.id).
As it's possible that there may be an article.id that is the same as a
member.id, I am considering adding two fields to the Image table (article_id
and member_id) one of which will be left blank for each record, depending on
the image's relation. For example, if "mypic.jpg" is related to article.id
288 in the Article table, then I would insert 288 into the article_id field
in the Image table but leave the member_id field blank.
Is this kosher, or is there a better way to do this?
Thanks!