$newtime = date("Y-m-d H:i:s", time() + 600);
mysql_query("UPDATE rounds SET clock = $newtime WHERE `round`='$CurrentRound' ") or die(mysql_error()); //update DB
此代码无法将当前时间(+10分钟)添加到MySQL数据库。
数据库中的单元格为日期时间格式。
我以前这样做过,但是在重写代码时,它已经停止工作。
你可以使用
UPDATE rounds SET clock = NOW() + INTERVAL 10 MIN WHERE round = '$CurrentRound'
将时钟设置为 10 分钟,每个 MySQL 服务器上的时间。
或者,您需要在$newTime
变量周围添加'
UPDATE rounds SET clock = '$newtime' WHERE round = '$CurrentRound'
将
查询更改为以下内容:
("UPDATE rounds SET `clock` = '$newtime' WHERE `round` = '$CurrentRound'")