Hi, please tell me why the result -------------------------------- the code: <?php $link = mysqli_connect("localhost", "root", "", "homedb"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } //MySqli Select Query $results = mysqli_query($link, "SELECT `id`, `expiry` FROM `ctltbl`"); $row = $results->fetch_row(); $id = $row[0]; $expiry = (int) $row[1]; if ($expiry > 0) { $sql = "UPDATE `ctltbl` SET `expiry` = $expiry - 1 where `id` = $id"; if (mysqli_query($link, $sql)) { echo "."; } else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } header("location:sysnav.html"); } echo "We're sorry but your contract has expired. Contact us immediately at uCanLease@yahoo.com"; ?> PHP: -------------------------------------------- result; fetch_row(); $id = $row[0]; $expiry = (int) $row[1]; if ($expiry > 0) { $sql = "UPDATE `ctltbl` SET `expiry` = $expiry - 1 where `id` = $id"; if (mysqli_query($link, $sql)) { echo "."; } else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } header("location:sysnav.html"); } echo "We're sorry but your contract has expired. Contact us immediately at uCanLease@yahoo.com"; ?> Code (markup):
There's some odd stuff happening here but let's start with this $sql = "UPDATE `ctltbl` SET `expiry` = $expiry - 1 where `id` = $id"; PHP: if you echo it out and put that straight into something like phpMyAdmin does the query run? Have you tried writing it as $sql = "UPDATE `ctltbl` SET `expiry` = DATE_ADD({$expiry},INTERVAL -1) where `id` = {$id}"; PHP: