Sunday, June 23, 2013

Re: about "Notice (8): Undefined index:"

Hi,

You can measure it by a new PDO driver.

2013年4月26日金曜日 18時45分40秒 UTC+9 Khánh Vương:
Hi, I have same error. Please let me know way to solve this problem. Thanks!

On Tuesday, April 2, 2013 11:26:14 PM UTC+7, wen ger0606 wrote:
I'm using 2.3.1 cakephp.
When you run the following simple code, "Notice (8): Undefined index: User [APP / View / Users / index.ctp, line 6]" occurs.
If you run in cakephp 2.3.1 on another server the same code, the error does not occur.

--------- UsersController.php -----------
class UsersController extends AppController {
    public $ uses = array ('User');
    public $ layout = 'default';
    public function index () {
      $ userData = $ this-> User-> find ('all');
      $ this-> set ('userData', $ userData);
    }
}

--------- User.php -----------
class User extends AppModel {
    public $ name = 'User';
}

--------- Index.ctp -----------
<table>
<php foreach ($ userData as $ data):??>
<tr>
   <td> <? php echo $ data ['User'] ['name'];?> </ td>
</ tr>
<php endforeach;??>
</ table>

--------- Debug ($ userData) -----------
$ userData = array (
   (int) 0 => array (
     (int) 0 => array (
             'id' => '1 ',
             'name' => 'suzuki'
     )
   )
)

Set so the server, I think that there is such a phenomenon occur?
If there is a point that I noticed something, please advice.
best regards

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: