Welcome Guest, Not a member yet? Register   Sign In
db cache question
#1

[eluser]Andres F.[/eluser]
Greetings,
I created a 'Miscellaneous' table, with a few fields. Controller calls the model, model returns the data from this 'Miscellaneous' table, view displays the data. That works fine.

However, I decided to add three more columns to this 'Miscellaneous' table. I added these columns to the select method in the model and they aren't getting pulled - a 1054 Unknown column field error appears. I also got rid of my select so the default of all fields would be chosen but the error still occurs. To double check, I did a print_r and these three additional fields don't appear. So, I changed my table name from 'Miscellaneous' to 'Miscellaneous2', updated the table used in the model's get method (from Miscellaneous to Miscellaneous2), hit refresh and then those three newly added fields appeared.

I don't have db caching on in my database config file, but this seems to be a cache issue. Is this a case of needing to flush the cache? If so, is it best to do this in the model's constructor, or better to place this in the particular model function used? I reviewed these articles:
Flush Cache
DB Cache

I'm just still slightly unclear as to:
1. if this is a db cache issue - when you add columns to the table later, does one need to clear the db cache for a select stmt to pick up newly added columns
2. if I need to flush my cache and if so, where exactly is the best place to do that (in the model's constructor or the model's function with that table call or other)

I'm using MAMP php version 5.2.6, mysql version 5.
Thanks for your help.

Regards,
Andres




Theme © iAndrew 2016 - Forum software by © MyBB