开发者

When saving to a model, created and modified aren't automatically populated by CakePHP. Using SQL Server

开发者 https://www.devze.com 2022-12-28 12:14 出处:网络
Hi when saving to a model, my created and modified fields aren\'t automatically populated by CakePHP. It was automatically populated when I was using MySQL but now it isn\'t. I\'m not using NOW() back

Hi when saving to a model, my created and modified fields aren't automatically populated by CakePHP. It was automatically populated when I was using MySQL but now it isn't. I'm not using NOW() back when I was still using MySQL. Why is it? Also when a field's value is not set 'NULL' (with quotes) is inserted causing errors because SQL Server says I 开发者_Go百科can't insert a string to a field of type smallint/date etc. How do I fix this?

Thanks in advance!


I would set NULL as a keyword rather than quoting it, which I imagine is why your database thinks that it's a string.

Have you double checked the schema of the database to ensure that the created and modified fields are still DATETIME fields.

Also you say "SQL Server", and mention MySQL, so I assume that you are now using MSSQL?

0

精彩评论

暂无评论...
验证码 换一张
取 消