Hi, This little program checks to see if the contract is valid. I have a database field "expiry"
(int 3) from which 1 is subtracted when run. As long as the expiry is above 0 I want to redirect to
"sysnav.html", otherwise I want to redirect to "expiredpage.html". I need help w/the redirects.Quoted Text Here
<?php
$link = mysqli_connect("localhost", "root", "", "prerentdb");
// Check connection
if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }
$id='id';
echo "<center>";echo date('m/d/y');echo "<br />";
// Attempt select query execution
$result = mysqli_query($link,"SELECT * FROM numbers");
$row= mysqli_fetch_array($result);
$id='id';
$expiry='expiry';
if ($_POST["expiry"] === $_POST["confirm_password"]) {
$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) // go to expiredpage.html
{
header("location:expiredpage.html");
}
else // go to sysnav.html
{
header("location:sysnav.html");
}
// Close connection
mysqli_close($link);
?>
the result:
even though expiry is 300, I get this:
Your contract has expired.
Contact the webmaster hereQuoted Text Here