0) { $sql = "select tvalid from voteattend where aid = '$tnum'"; $result = $conn->query($sql); $num = $result->num_rows; if($num > 0) { $row = $result->fetch_assoc(); $vstatus = $row["tvalid"]; if ($vstatus <> 1) { $_SESSION['num_show'] = $tnum." 號票未有登記!"; header("Location:deletetheticket.php"); } else { $sql = "Update voteattend set tvalid=0 where aid = '$tnum'"; $result = $conn->query($sql); $_SESSION['num_show'] = $tnum." 號票成功取消登記!"; } } } else { $_SESSION['num_show'] = $tnum." 號不是票,取消登記失敗!"; } header("Location:deletetheticket.php"); ?>