The debug code you posted starts like this:
app\controllers\products_controller.php (line 13)
Array
(
[Data] => Array
So, you actually set a variable called $Data (capital 'D'), not $data.
PHP is case sensitive. Make sure that you're naming it "data" in your
controller AND using "data" in your view.
- Jamie
On Jan 20, 8:47 am, tacoparty <[email protected]> wrote:
> Thanks, I'll look for some more recent basic tutorials. I commented on
> the site but nobody responded. I at least have CakePHP installed and
> working, so that's a start.
>
> Thanks again! Very pleased with the CakePHP community so far. Very
> helpful, not condescending to newbs like myself.
>
> On Jan 20, 9:55 am, PHPMine <[email protected]> wrote:
>
>
>
>
>
>
>
> > this tutorial looks old and incompatible with the latest version of
> > cake. furthermore, put "debug($data);" without the quotes of course,
> > after the Products->find() to verify you actually have data. then put
> > that same code in your view to verify the data makes it to your view.
>
> > lastly, comment on the tutorial and ask the author if he can make an
> > updated version for Cake 1.3
>
> > On Jan 19, 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);
> > > }}
--
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