What you probably want to do is take a look at what you have in the $books array at the end of your controller. A quick and dirty way is to put a var_dump($books); as last statement in your controller function. The contents will then show up at the top of your view. Check if the ['Author']['name'] data is there. Does it work without recursive=1? (My guess is the problem is to do with the Author table and your model definition)
FYI, the htmlhelper::tableCells & tableHeaders functions are nice for generating tables. :) I believe also that the preferred way in cakephp 1.2 to optimize database calls is to use containable behavior. ie. replace $this->Book->recursive = 1; with $this->Book->contain('Author'); http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/ But try getting it to work first without optimization. On Oct 3, 1:14 am, "S/*\\L/*\\L/*\\M" <[EMAIL PROTECTED]> wrote: > hi all, > i m very new in cakePHP, pls help me some one about this error, which > is headeach for me. > => i m getting error of [Undefined index] in abc view file.i m > pasting code here if some 1 got it then pls help me. > thanx > > =>this controller file code for index... > function index() { > $this->Book->recursive = 1; > $books = $this->Book->find('all'); > $this->set('books', $books); > > } > > =>and this one code for index.ctp > <?php foreach($books as $book): ?> > <tr> > <td><?php echo $book['Book']['isbn']; ?></td> > <td><?php echo $book['Book']['title']; ?></td> > <td><?php echo $book['Author']['name'] ;?></td> > </tr> > <?php endforeach; ?> > ....i am waiting :) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---