Thanks for the help, gave that a try and below is what I got, so I
know there is data in the table, anyway. I don't know how to
troubleshoot much else. I was hoping CakePHP would be a good platform
to actually learn PHP but so far not so much.

app\controllers\products_controller.php (line 13)
Array
(
    [Data] => Array
        (
            [0] => Array
                (
                    [Product] => Array
                        (
                            [product_id] => 1
                            [product_name] => test
                            [product_desc] => test description
                            [product_price] => 10
                        )

                )

            [1] => Array
                (
                    [Product] => Array
                        (
                            [product_id] => 2
                            [product_name] => test 2
                            [product_desc] => test desc 2
                            [product_price] => 11
                        )

                )

        )

)

On Jan 19, 9:05 pm, cricket <[email protected]> wrote:
> On Wed, Jan 19, 2011 at 8:34 PM, tacoparty <[email protected]> wrote:
> > Hello,
>
> > I am a complete newbie to PHP and especially CakePHP and am going
> > through a few tutorials I found online.
>
> > The one I'm having problems with is located here:
> >http://www.switchonthecode.com/tutorials/cakephp-using-helpers#commen...
>
> > I've followed all the steps verbatim but when I try to go to the page
> > to see the results it returns two error messages. The table headers
> > show up but no data.
>
> > Undefined variable: data [APP\views\products\index.ctp, line 14]
>
> > Invalid argument supplied for foreach() [APP\views\products\index.ctp,
> > line 14]
>
> > This is what my controller file looks like:
>
> > class ProductsController extends AppController
> > {
> >  var $name = "Products";
> >  var $helpers = array('Html');
>
> >  function index()
> >  {
> >    $data = $this->Product->find('all');
>
> >    $this->set('data', $data);
> >  }
> > }
>
> Looks ok to me. Even if the result was empty, $data should exist. Try
> adding this right after the call to set():
>
> die(debug($this->viewVars));
>
> Make sure debug is set to 2 in core.php.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to