Place who have pointed out, it was my mistake of copy and paste.
By the way, earlier, was found to cause.
Was v5.0.33 version of PDO Driver for MySQL on the server I'm using.
For this purpose,
lib \ Cake \ Model \ Datasource \ Database \ Mysql.php
was due getColumnMeta function that will be used in the resultSet function can not get the table name.
Thank you to answer me.
2013年4月3日水曜日 16時28分03秒 UTC+9 Jerome Walitzek:
hi there,--i think your "index.ctp" file not correct.you write<table>
<php foreach ($ userData as $ data):??>
<tr>
<td> <? php echo $ data ['User'] ['name'];?> </ td>
</ tr>
<php endforeach;??>
</ table>please write <?php ..... ?> and not <php .... ??>try this one<table>
<?php foreach ($userData as $data): ?>
<tr>
<td><?php echo $data['User']['name'];?> </ td>
</ tr>
<?php endforeach; ?>
</ table>i hope it helps you
Am Dienstag, 2. April 2013 18:26:14 UTC+2 schrieb wen ger0606: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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment