我正在尝试更新数据库中的条目,我已经加密了字段uniqueID
可能是加密字段的uniqueId引起问题。
$query = "SELECT UniqueID FROM configuration";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
echo $num_rows;
while($row = mysql_fetch_assoc($result))
{
$dbuniqueID = Encryption::decrypt($row['UniqueID']);
if($dbuniqueID == $UniqueID)
{
// $UniqueID = Encryption::encrypt($UniqueID);
echo $UniqueID;
$insert = "UPDATE configuration SET status = 'ready', original_conf_path = '$Filepath'
WHERE UniqueID = '$UniqueID'";
mysql_query($insert);
}
}
最佳答案
没有用于比较或插入的$UniqueID
-应该为$row['UniqueID']
$insert = "UPDATE configuration SET status = 'ready', original_conf_path = '$Filepath'
WHERE UniqueID = '$row[UniqueID]'";
您还应该转义它:
$insert = "UPDATE configuration SET status = 'ready',
original_conf_path = '" . mysql_escape_string($Filepath) . "'
WHERE UniqueID = '" . mysql_escape_string($row['UniqueID']) . "'";
关于php - 更新不适用于MySQL和PHP,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1788650/