Sunday, July 4, 2010

Re: ERROR: Notice (8): Undefined index: User [APP\views\users\profile.ctp, line 25]- can't find the problem

My advice with all of these sort of issues is to debug out the results of the array you are parsing. It then becomes really easy to see what syntax you need to get to the right data:

die(debug($your_variable));

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 4 Jul 2010, at 18:27, Tomfox Wiranata wrote:

> oki...i just embarrassed myself...
>
> delete ['User'] and it works^^
>
> On 4 Jul., 18:58, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>> hi,
>>
>> i try to retrieve user data and echo it in a view.
>>
>> my view:
>> <table>
>> <tr>
>> <th>name</th>
>>
>> </tr>
>>
>> <?php foreach ($users as $user): ?>
>>
>> <tr>
>> <td><?php echo $user['User']['firstname']; ?></td>
>> <<<<<<<<<<<<<<<<< line 25 !!!!
>> </tr>
>> <?php endforeach; ?>
>>
>> </table>
>>
>> controller:
>> function profile()
>> {
>> $this->set('users', $this->User->findByUsername($this->Session->read('User.username')));
>>
>> }
>>
>> its drivin me nuts....i dont think i did sth different from the blog
>> example ??
>>
>> thx so much
>>
>> btw: the sql-statement is correct. it returns the value i need.....
>
> 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

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

No comments: