我试图删除一个变量作为 IF 语句的一部分。主题是折扣系统,如果陈述为真,我想知道如何删除变量。
<td><?php echo "£" . $total_price . "<br /> <br />";
$conn = connect();
if(isset($_POST['discountSubmit'])){
$discountCode = $_POST['discount'];
$codeCheck = mysqli_query($conn, "SELECT * FROM discount WHERE code = '$discountCode'");
if(mysqli_num_rows($codeCheck)> 0 && $total_price >= 30.00) {
$row3 = mysqli_fetch_assoc($codeCheck);
$discount_price = $total_price - $row3['discount'];
echo "£" . $discount_price;
} else if
($total_price <30.00) {
echo "CODE DENIED";
}
}
?>
目前该语句同时显示原始价值和新的总价,如果可能的话,理想情况下原始的 $total_price 会有三振?