![]() |
Problem with $useTimestamp - 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: Problem with $useTimestamp (/showthread.php?tid=76382) |
Problem with $useTimestamp - wdeda - 05-07-2020 I have a question about the protected "function" in Model. I was watching a sequence of videos on YouTube about the "Create news items" tutorial and decided to follow the step-by-step instructions. At a certain point I was unable to proceed, just at the moment when I would update the table with the option $useTimestamps. The first thing I noticed is that in the videos the version used was "beta 4". I made several attempts but couldn't, so I decided to go to the basics: list a field from the table: foreach ($news as $row); echo $row['title']; I did not make it! See attached image with the description of the error. Only after removing this field with "false" and the others adding a comment sign did I get it. According to the manual: "This boolean value determines whether the current date is automatically added to all inserts and updates. If true, will set the current time in the format specified by $ dateFormat. This requires that the table have columns named 'created_at' and 'updated_at' in the appropriate data type. " Model: PHP Code: <?php namespace App\Models; Controller: PHP Code: <?php namespace App\Controllers; In the video, https://www.youtube.com/watch?v=FVCXhqWF4CM, despite some confusion with coding, at 15:00, everything works perfectly. In the attached image of the table, the only record was created manually. [SOLVED] Problem with $useTimestamp - wdeda - 05-11-2020 I can't explain how or why, but the problem just disappeared, it's flawless. In the image below, updates and deletions performed on the table. I'm sorry, for the "false alarm". |