updated_at field is not working - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: updated_at field is not working (/showthread.php?tid=81641) |
updated_at field is not working - razzor - 03-31-2022 Hi there, i tried all this methods posted here and googled out but found nothing useful. The wierd thing is 'created_at' is working but 'updated_at' gets a null value so here is my model PHP Code: <?php Code: Here is my controller PHP Code: <?php Code: and here is my DB Code: DROP TABLE IF EXISTS `users`; Thanks in advance. RE: updated_at field is not working - iRedds - 04-01-2022 1. Timestamps are set automatically if configured correctly. There is no point in events. 2. If the data does not have a primary key when using the Model::save() method, then it will be considered that this is a new record and, accordingly, update events will not be called. RE: updated_at field is not working - razzor - 04-01-2022 i just setted up $useTimestamps to true and its working fine See the documentation |