Adding last_updated and created to every row in DB

#1
[eluser]jhob[/eluser]
I'll start off by saying that I am totally new to codeigniter and just starting my first project with it so this can be considered a newbie question!

I want to add datetime columns for last_updated and created to every table in my database and was looking to find a way that wouldn't end up with the same repeated code for doing this in each model. Where would be best to do this or is it going to be easiest just to repeat the code?

Additionally, what would be the best format to store the datetime in? i.e. is there a format that will make my life easier within codeigniter?

Thanks in advance for any replies,
John

#2
[eluser]Aken[/eluser]
Jamie Rumbelow's base model sounds like it'd be helpful for you.

As for how to store datetime, that's up to you; there are pros and cons to each way of storing a date/time. You can do DATETIME or INT and store the Unix timestamp. Use whichever works best for you.

#3
[eluser]jhob[/eluser]
That looks like just the ticket and much more besides. Thanks!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.