gpt4 book ai didi

php - 是否在 MySQL 中创建触发器(通过 PHP)?

转载 作者:行者123 更新时间:2023-11-29 04:59:12 25 4
gpt4 key购买 nike

MySQL 中的表有 1 个问题列:creation_date

在通过PHP插入新行的过程中,我认为直接在查询中插入日期是正确的,MySQL必须自己做。

我是否需要执行触发器,或者最好按预期使用 PHP 来执行此操作?你会怎么做?

附言:MySQL: How to create trigger for setting creation date for new rows

最佳答案

使用 TIMESTAMP DEFAULT CURRENT_TIMESTAMP 字段

http://dev.mysql.com/doc/refman/5.0/en/timestamp.html

关于php - 是否在 MySQL 中创建触发器(通过 PHP)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3395640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com