Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php I';当另一列发生更改时,我正在尝试更新其中一列中的值_Php_Mysql - Fatal编程技术网

Php I';当另一列发生更改时,我正在尝试更新其中一列中的值

Php I';当另一列发生更改时,我正在尝试更新其中一列中的值,php,mysql,Php,Mysql,语句的最后一部分“User=IF statement”我似乎做得不对。如果上次修改的列已经更新,我基本上只想更新用户列。欢迎使用StackOverflow。您可以通过选择代码,然后按CTRL+K来格式化代码,如下所述:谢谢提示。 `$sql = "INSERT into file (filename, filepath, lastmodified, ago, timestamp, User) VALUES ('$x','$legend', '$time', '$ago', '$timestamp

语句的最后一部分“User=IF statement”我似乎做得不对。如果上次修改的列已经更新,我基本上只想更新用户列。

欢迎使用StackOverflow。您可以通过选择代码,然后按CTRL+K来格式化代码,如下所述:谢谢提示。
`$sql = "INSERT into file (filename, filepath, lastmodified, ago, timestamp, User) VALUES ('$x','$legend', '$time', '$ago', '$timestamp', '$user')` 
ON DUPLICATE KEY UPDATE lastmodified = '$time', ago = '$ago', User = IF(lastmodified > NOW() - INTERVAL 10 MINUTES, '$user', User)"; 
 $result = $conn->query($sql);