Jump to content

Recommended Posts

I have 3 database tables a plants table, a chemicals table and a preparations table. Some plants have chemicals in them and there are preparations that can be made from them. I need a way to cross reference them to keep track of which chemicals are present in which plants and preparations and which preparations contain which chemicals and plants etc.

 

What I did right now is add a preparations field and a chemicals field to the plants table. A plants field and a preps field to the chemicals table etc. In these fields I list the ID number of the items to be cross referenced. Is there a simpler and more effective way to do this? I'd really rather not have these extra fields in each table I've heard of people creating separate tables for cross referencing. is that the most effective way to do it?

Link to comment
https://forums.phpfreaks.com/topic/190989-cross-referencing/
Share on other sites

creating a table with (at least) 3 fields:

1) plant-id

2) chemical-id

3) preparation-id

 

Every record in this table will show a plant linked to a chemical and to a preparation, if any of these fields is not applicable, you can set them to NULL.

This way you could have more plants/chemicals/preparation per plant, and i dont see how you would do that now...

 

Link to comment
https://forums.phpfreaks.com/topic/190989-cross-referencing/#findComment-1008785
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.