Guys, what am I doing wrong? The database "expiry" value is > 0 but I go to expiredpage.html.
<?php $link = mysqli_connect("localhost", "root", "", "numbersdb"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } echo "<center>";echo date('m/d/y');echo "<br />"; $id='id'; $expiry='expiry'; if($expiry==7) {echo "1 week remaining on contract<br />";} if($expiry==1) {echo "1 day remaining on contract<br />";} if ($expiry==0) { header("location:expiredpage.html"); exit; } // not = 0, but goes there // Perform a query, check for error $sql = "UPDATE numberstbl 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); } ?>



Back to top







