thanx for ur time.
- ya u r rite that htmlhelper is easy way to genrate tables cell and
headers..
but i m trying to learn some code myself.. :p
- i m trying to made relationship b/w books and authors tables...i think its
relation is not make properly.
-how to make foreign key?..i think thats the problem.
thanx
On Fri, Oct 3, 2008 at 11:13 PM, qwanta <[EMAIL PROTECTED]> wrote:
>
> 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 :)
> >
>
--
Best Regards
ABDUS SALAAM
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---