Did you try to cycle it with a foreach and search within? Never used the 
in_array function. I'll take a look at it.

foreach($this->data['Ingredient'] as $ingredient):
    if($ingredient == $ingredient_chosen) {
       echo "found!";
    }
       else
    {
       echo "not found!";
    }
endforeach;
   


Luke ha scritto:
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to