Jump to content

Searching


murra1a

Recommended Posts

Hi,

 

I have 3 tables:

ingredient, recipes, onhand

 

ingredient is 2 fields: key, name

 

recipes is several fields, important one is ingredients which is keys from ingredients table separated by commas eg 2,3,15,99

this essentially connects the list of ingredients in the recipe to ingredient names in the 1st table

 

the third table is a list of ingredients I have on hand and their keys from the ingredient table.

 

 

What I want to do is to search the recipe table for recipes I can make with the ingredients I have on hand

and recipes for which I am missing only a few ingredients

 

I am completely confused about how to do this

Thanks

Ryan

Link to comment
https://forums.phpfreaks.com/topic/121507-searching/
Share on other sites

Here is a sample of the three tables

 

Ingredients:

Key Ingredient

1    Bacon

2    Tomato

3    Lettuce

4    Bread

5    Eggs

 

Recipes:

Recipe                    Ingredients

BLT                        1,2,3,4

Bacon and Eggs      1,5

 

OnHand:

StuffOnHand        IngredientKey

Bacon                  1

Tomato                2

Eggs                    5

 

I want to output:

1. That I can make bacon and eggs

2. That I can make a BLT if I get Lettuce and Bread

 

I hope that is more clear

Thanks

Link to comment
https://forums.phpfreaks.com/topic/121507-searching/#findComment-626965
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.