Wednesday, March 31, 2010

Re: Undefined index

Please look at the code at line 32 from the indexsln.ctp file. Compare
the index names with the expected structure. Do you really have an
index named "Endpoint"?
If you still can't see the error, then please show the code at line
32, so we also may be able to look at it :)
Enjoy,
John

On Mar 31, 4:35 pm, newbie <karola.pa...@gmail.com> wrote:
> Hi All,
>
> I'm getting error:
> Notice (8): Undefined index: Audit [APP\views\audits\indexsln.ctp,
> line 32]
> Notice (8): Undefined index: Endpoint
>
> the codes are
>
> index.ctp:
>
>      <?php
>    $options = array_combine ($a_eid, $a_sln);
>    //$form->create('audits'
>     echo $form->create('Audit', array( 'controller' => 'audits',
> 'type' => 'post', 'action' => 'indexsln'));
>     echo $form->select('endpoint_id',$options);//,null,null,false);
>     echo $form->submit('ok');
>     echo $form->end();     ?>
>
> audits_controllers :
>
>         function indexsln()    {
>                 $id = $this->data['Audit']['endpoint_id'];
>                 echo $id; //$sln;
>
>                 $this->set('audits',$this->Audit->query(
>                                 "SELECT * FROM audits,endpoints WHERE endpoint_id
> in
>                                 (SELECT id FROM endpoints WHERE sln in
>                                 (SELECT sln FROM endpoints WHERE id = ".$id."))
>                                 AND audits.endpoint_id = endpoints.id "));
>
>                                 $data=$this->paginate($this->Audit->read());
>     }
>
> indexsln.ctp :
>
> <div class="audits index">
> <h2><?php __('Audits');?></h2>
> <p>
> <?php
> echo $paginator->counter(array(
> 'format' => __('Page %page% of %pages%, showing %current% records out
> of %count% total, starting on record %start%, ending on %end%', true)
> ));
> ?></p>
> <table cellpadding="0" cellspacing="0">
> <tr>
>         <th><?php echo $paginator->sort('id');?></th>
>         <th><?php echo $paginator->sort('endpoint_id');
>                 ?></th>
>         <th><?php echo $paginator->sort('day');
>                 echo $paginator->sort('date');?></th>
>         <th><?php echo $paginator->sort('author');?></th>
>         <th><?php echo $paginator->sort('description');?></th>
>         <th><?php echo $paginator->sort('action');?></th>
>         <th><?php echo $paginator->sort('visible');?></th>
>         <th class="actions"><?php __('Actions');?></th>
> </tr>
> <?php
> $i = 0;
> foreach ($audits as $audit):
>         $class = null;
>         if ($i++ % 2 == 0) {
>                 $class = ' class="altrow"';
>         }
> ?>
>         <tr<?php echo $class;?>>
>                 <td>
>                         <?php echo $audit['Audit']['id']; ?>  // line 32
>                 </td>
>
> debuger result example:
>
>     [viewVars] => Array
>         (
>             [audits] => Array
>                 (
>                     [0] => Array
>                         (
>                             [audits] => Array
>                                 (
>                                     [id] => 6
>                                     [endpoint_id] => 12
>                                     [ton_id] =>
>                                     [day] => 2010-01-16
>                                     [created] => 2010-01-16 20:40:28
>                                     [author] => Ktos
>                                     [trid] => 123444
>                                     [description] => Did Something
>                                     [action] => Change
>                                     [visible] => 0
>                                 )
>
>                             [endpoints] => Array
>                                 (
>                                     [id] => 12
>                                     [ton_id] => 1
>                                     [name] => RU22005-RDFSWQ990099
>                                     [sln] => RU22005
>                                     [fga] =>
>                                     [date] => 2009-11-29 01:39:00
>                                     [push] => Success
>                                     [activation] => Success
>                                     [created] => 2009-11-29 01:43:00
>                                     [modified] => 2009-11-29 01:43:00
>                                     [col1] => k
>                                     [col2] => k
>                                     [col3] => k
>                                     [col4] =>
>                                     [col5] =>
>                                     [col6] =>
>                                     [col7] =>
>                                     [col8] =>
>                                     [col9] =>
>                                 )
>
>                         )
>
> i have the same code as indexsln.ctp in other function when i'm
> sending data using fndAllBy - it's all ok then.
> dubuger seems to be ok in both cases.
>
> Can you please point out what i'm doing wrong?
>
> thx

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.

No comments: