"updated_at" field filled during an insert operation |
the updated_at field filled during an insert operation, not only created_at field. Even though I only intend to insert into the database. is it normal?
thanks.
Yes anytime you update a database record the updated_at field will ne updated.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thank you for your quick response...
So, it's normal for both the 'created_at' and 'updated_at' fields to be filled when we INSERT data into the database (not update operation). PS: i'm using SQLite3
Created_at is only created when the record is created.
updated_at is updated every time the record is changed with new data. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
The structure to be used is as follows:
type => DATETIME default => null attributes => on update CURRENT_TIMESTAMP
If plan A fails, relax... the alphabet is 26 letters
created_at is only set once when the record is created, it will never be set again unless you change it.
updated_at is changed every time you insert or update the record. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-13-2024, 10:08 PM)InsiteFX Wrote: created_at is only set once when the record is created, it will never be set again unless you change it. Thank you, the answer that really helps me understand why the updated_at field contains data even though I only inserted new data once. (07-14-2024, 04:11 AM)wdeda Wrote: My apologies, I didn't actually read your remark that you use SQLite3. I agree with @InsiteFX, but what you reported is possible to happen in MySql if 'updated_at' is not set properly. I also forgot I was using an SQLite db ![]() |
Welcome Guest, Not a member yet? Register Sign In |