我想运行这个脚本来更新数据库,然后检查它是否确实更新了,然后设置一个变量这样说并重定向回上一页并回显该页面上的成功更新或不成功更新。目前它运行完美,但不会回显成功或不成功的部分。我能做些什么来解决这个问题?
<?php
include_once('../../../_php/connect.php');
$update_e_id = $_POST['error_id'];
//Update unresolved to resolved
mysql_query("UPDATE error SET resolution='resolved' WHERE id=" . $update_e_id . "
AND resolution='unresolved'");
//Check if it updated
$checkE_update = "SELECT * FROM error WHERE id=" . $update_e_id . " AND
resolution='resolved'";
$results = mysql_query($checkE_update);
$nr = mysql_num_rows($results);
while($row = mysql_fetch_assoc($results)) {
$checkResolution = $row['resolution'];
}
if($checkResolution = 'resolved') {
$successfullyUpdated = "<p>The error is now resolved.</p>";
header("Location: ../lib_errors.php");
} else {
$didnotUpdateError = "<p>The update was unsuccessful.</p>";
header("Location: ../lib_errors.php");
}
?>