Skip to content
Advertisement

CakePHP adding columns to a table

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 accountit returns no information (nothing prints, but no errors). Any suggestions?

Advertisement

Answer

I would delete the files in app/tmp/cache (but keep the directories).

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement