jimdidr Posted September 25, 2008 Share Posted September 25, 2008 How would i go about adding the possibility of haveing 40 recipe ingredients in a database... I just want to make a simple Database where people can just write in recipes for Whatever they feel like. and i'm stuck on the point of how to having upto 40 variables added the easyest, (i want to be able to index the recipes by ingrediense and also search thru them, so I'm guessing 1 blob of ingredience are out. Any ideas? Quote Link to comment Share on other sites More sharing options...
jimdidr Posted September 25, 2008 Author Share Posted September 25, 2008 What i mean is. Is there a better way to do this then to just add 40 fields and call them ingredient 1-40 (and then add 40 others that say the amount, and 40 more that say what type of amount (Liters, DLs, gallons and so on) Quote Link to comment Share on other sites More sharing options...
xtopolis Posted September 26, 2008 Share Posted September 26, 2008 You need to read up a bit about database normalization. It will seriously benefit you in the long run. Google 'database normalization' But to answer your question, you should have separate the tables, rather than add columns But even simpler if you "just want to have a place where people can write recipes"... then just make it store a text area... and allow them to edit it? You can provide all the recipe info in a textarea <textarea rows="20" cols="30" name="recipe"> Pancakes Prep: Turn on stove to high. Directions: 1) Add 1 cup instant pancake mix to a bowl. 2) Add 3/4 cup water to bowl 3) Mix water and pancakes, leave slightly chunky.(Do not over mix) </textarea> .. etc That is an alternative, otherwise if you want to do it the complex but 'right' way... You'll need a fair bit of tables, in order to follow normalization standards. Tables for each: ingredients, measurements, recipe difficulty, submitter, etc etc... depending on how complex you need it. [not to mention lookup tables!] Quote Link to comment Share on other sites More sharing options...
jimdidr Posted September 26, 2008 Author Share Posted September 26, 2008 Thank you, that answerd my question. I was just hoping there was a simpler way of doing it the complex (and right) way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.