Welcome Guest, Not a member yet? Register   Sign In
change controller to see more than one occurance of ingredients
#1

[eluser]scoobie[/eluser]
Hello all,

I have a problem / issue whereby i am not sure how to get my select statement to show me what i know it should be and
am hoping someone can tell me how to change this to be correct ?

say i have 2 recipes (shortbread and scones)

shortbread has these ingredients =
250g butter
140gm icing sugar
300gm plain flour
75gm cornflour
5ml vanilla extract

and scones has these =
450gm self-raising flour
80g butter
250ml milk


and i want to get ingredients for 2 lots of shortbread and 1 lot of scones,


in my db i have all of the ingredients (as well a categories of food like 'cold storage',
'herbs / spices' and 'Long Life - Sugar / Baking'
and from the db i want to create a shopping list that itemises the ingreients and the
quantities into categories so i would be expecting something along the lines of


Cold Storage 580 Gram Butter
500 Millilitre Milk
Herbs / Spices 10 Millilitre Vanilla extract
Long Life - Sugar / Baking 150 Gram Flour - cornflour
600 Gram Flour - plain
450 Gram Flour - self-raising
280 Gram Icing sugar


however, what's actually returning is

69 occurred 2 times! 68 occurred 1 times!
Cold Storage 250 + 80 Gram Butter it's not adding here either but the sum give an error in codeigniter that i'll try to fix later
250 Millilitre Milk
Herbs / Spices 5 Millilitre Vanilla extract
Long Life - Sugar / Baking 75 Gram Flour - cornflour
300 Gram Flour - plain
450 Gram Flour - self-raising
140 Gram Icing sugar

so the 'select' is only seeing 2 recipes ie. it's not seeing that one recipe is chosen
twice (shortbread) and the other recipe (scones) is only chosen once

i have to put CI code in another post as it wont fit here, sorry


Messages In This Thread
change controller to see more than one occurance of ingredients - by El Forum - 11-04-2013, 09:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB