简体   繁体   中英

New to CakePHP -> How To Add Columns To a MySQL Table?

I had a website made for me a long time ago, and the programmer did it in CakePHP. I'm now editing his scripts.

I added a couple columns to a table, and found that doing saveField() on the new column does not do anything. How do I make CakePHP recognize the new columns?

I'd appreciate your help. I'm not too familiar with CakePHP, so please go easy on me =)

The cache data is saved in YourAppFoloer/tmp/cache/models (delete the files there-in)

You can also try Cache::clear()

http://book.cakephp.org/view/1382/Clearing-the-Cache

Edit - this looked horrible in the comment:

You could add it to a controller to call:

function superHandyCacheClearer() { $this->autoRender = false; Cache::clear(); }

And call www.yourcakeapp.com/yourControllerYouAddedItTo/superHandyCacheClearer - but really, this is when you're making changes whilst in the code. Deleting the cache folder contents, really, should be the fix

make sure that the cache folder is still laid out like it was initially

cache
   models
   persistent
   views

And that they are all 'writable' by the webserver, also note that unless you are running with a debug level of 0 some cache files may not be created every request. But remember that anytime you alter the model files or the database itself you should clear the cache/models folder.

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM