CakePHP adding columns to a table
Posted
by vette982
on Stack Overflow
See other posts from Stack Overflow
or by vette982
Published on 2010-06-10T04:11:40Z
Indexed on
2010/06/10
4:23 UTC
Read the original article
Hit count: 259
I have a Profile model/controller in my cake app as well as an index.ctp view in /views/profiles. Now, when I go to add a column to my table that is already filled with data, and then add the corresponding code to the view to pick up this column's data, it just gives me an empty result.
My model:
<?php
class Profile extends AppModel
{
var $name = 'Profile';
}
?>
My controller:
<?php
class ProfilesController extends AppController
{
var $name = 'Profiles';
function index()
{
$this->set('profiles', $this->Profile->find('all'));
}
}
?>
My views printing (stripped down):
<?php foreach ($profiles as $profile): ?>
<?php echo $profile['Profile']['id']; ?>
<?php echo $profile['Profile']['username']; ?>
<?php echo $profile['Profile']['created']; ?>
<?php echo $profile['Profile']['thumbnail'];?>
<?php echo $profile['Profile']['account'];?>
<?php endforeach; ?>
Basically, the columns id, username, column, thumbnail
always have been printing fine, but when I add a column called account
it returns no information (nothing prints, but no errors). Any suggestions?
© Stack Overflow or respective owner