Maybe $prod is empty? What happens when you add die(debug($prod)); after the 
find in the show function?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 17 May 2013, at 05:22:19, Victor Daniel Ojeda <[email protected]> wrote:

> I have 
> 
> show.ctp
> --------------
> <?php 
> foreach ($prod as $p):
>     echo $p['Producto']['id'];
>     echo $p['Producto']['descripcion'];
> endforeach;
> ?>
> 
> 
> Producto.php (model)
> -------------------------------
>     public function getProducto($descripcion = null) {
>         $this->find('all', array('conditions' => array('descripcion' => 
> $descripcion)));
>       }
> 
> 
> and controller ProductosController.php
> --------------------------------------------------------
>     public function show() {
>         $descripcion = $this->request->data['Producto']['search'];
>         $prod = $this->Producto->getProducto($descripcion);
>         $this->set(compact('prod'));
>       }
> 
> 
> but not work :(
> 
> Warning (2): Invalid argument supplied for foreach() 
> [APP\View\Productos\show.ctp, line 2]
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


  • search by field Victor Daniel Ojeda
    • Re: search by field Jeremy Burns | Class Outfit

Reply via email to