Find Value in $this-data

2009-09-25 Thread Luke

Hi Guys,

I am trying to find out if a Value in the $this-data Array excists.
Here the structure of the Array:

Array
(
[Recipe] = Array
(
[recipe_name] =
)

[Ingredient] = Array
(
[1] = Array
(
[ingredientname] = Milk

)

[0] = Array
(
[ingredientname] = Water

)

)
}

I now wanted to use:

if (!in_array($value['In']['ingredientname'],$this-data
['Ingredient']) )

So, if it is not in the array I wanted to give a message out. This
does not work for some reason, did I missunderstand the in_array
function? Any idea to achieve it otherwise?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Find Value in $this-data

2009-09-25 Thread lordG

You could try the isset function. isset($this-data['Ingredient']
[$value['In']['ingredientname']]). But if $this-data['Ingredient']
[$value['In']['ingredientname']] is null, it will also return false.
isset checks if variable exists and is not null.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---