Problem with $useTimestamp |
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. |
Welcome Guest, Not a member yet? Register Sign In |