0
我遇到了问题,我的代码没有更新现有的计算机数据。如果我删除ON Duplicate部分,代码将正常工作并添加数据。我在我的xampp数据库中制作了我的唯一密钥。任何帮助将不胜感激。重复密钥更新 - 不更新
<?php
$receive = htmlspecialchars($_POST['time']);
list($length, $status, $computer) = split(":", $receive, 3);
include('connection.php');
mysqli_query($dbc, "INSERT INTO screen(computer,status,length)
VALUES('$computer','$status','$length')
ON DUPLICATE KEY UPDATE
status=$status, length=$length");
?>
你忘了你的qoute更新值 - >'更新状态= '$状态',长度='$ length'' – Sean 2014-09-06 21:44:07
肖恩 - 你是我的英雄。感谢您的修复 – MIchaelfjsmith2 2014-09-06 21:48:35