我正在尝试在 PHP 中使用 AES_ENCRYPT 进行基本的 mysql 更新,但我无法让它工作。这是我的完整代码:
$key = "bac09c63f34c9845c707228b20cac5e0";
$query = " SELECT id, aes_decrypt(Column1, '$key') AS Column1, aes_decrypt(Column2, '$key') AS Column2 FROM parent WHERE Request = '{$Request}' ORDER BY ID ASC;";
$resultSet = mysql_query($query, $DB);
while ($row = mysql_fetch_array($resultSet)) {
$id = $row['ID'];
$rows[] = $row["Request"];
$Column1 = $row["Column1"];
$Column2 = $row["Column2"];
$SQL = "UPDATE parent SET Column1 = AES_ENCRYPT('$Column1','$key'), Column2 = AES_ENCRYPT('$Column2','$key') WHERE Parent_ID = '$id';";
if (!mysql_query($SQL, $DB))
die("Query Failed $SQL");
}
PHP错误日志很好,没有错误。只有这个:
Query Failed
UPDATE parent SET Column1 = AES_ENCRYPT('722225374673255299521908919676768...etc','bac09c63f34c9845c707228b20cac5e0')