Hi, this should be simple but I'm having trouble and need help, please. I just want to update the
"expiry" value in the "ctltbl" and relocate depending on the value.
The update doesn't happen and it goes to sysnav even when expiry is 0. "ctltbl" is 1 row.
<?php
//Open a new connection to the MySQL server
require_once "gethomedb.php";
//MySqli Select Query
$results = $mysqli->query ("SELECT * FROM ctltbl");
$id='id';
$expiry='expiry';
$sql = "UPDATE ctltbl
SET $expiry = expiry - 1 where id=$id";
if(mysqli_query($link, $sql)){ echo "record was updated successfully."; }
else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }
if($expiry=0) { header("location:expiredpage.html"); }
else { header("location:sysnav.html"); }
?>