Get DATETIME in php and post it to MySQL for transaction consistency

后端 未结 3 994
一向
一向 2020-12-31 17:41

Here is a link to the reason behind this question: NOW() for DATETIME InnoDB Transaction guaranteed?

So to ensure a single transaction with any number of queries (

3条回答
  •  离开以前
    2020-12-31 18:16

    Do it in MySQL, so you don't involve PHP at all:

    select @now := now();
    
    insert into .... values (@now)
    select from ... where x=@now
    etc....
    

提交回复
热议问题