Will you tell what I'm doing wrong. It goes straight to "expiredpage.ht ml" even though the value
of "expiry" is more than 0. I keep studying redirection and variable definition but nothing works. It does
update.
of "expiry" is more than 0. I keep studying redirection and variable definition but nothing works. It does
update.
Code:
<?php
$link = mysqli_connect("localhost", "root", "", "prerentdb");
// Check connection
if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }
$id='id';
$expiry='expiry';
$sql = "UPDATE numbers SET expiry=$expiry- 1 where id=$id";
if(mysqli_query($link, $sql)){ echo "expiry was updated successfully."; }
else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }
if ($expiry == 0) {
header("location:expiredpage.html");
// window.location.href = 'expiredpage.html';
// $(location).attr('href', 'expiredpage.html')
}
else {
header("location:sysnav.html");
//window.location.href = 'sysnav.html';
// $(location).attr('href', 'sysnav.html')
}
// Close connection
mysqli_close($link);
?>
Comment