Guys, what am I doing wrong? The database "expiry" value is > 0 but I go to expiredpage.html. 
========================================================
the code:

<?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); }
?>

$expiry='expiry';

That sets the variable expiry to the string 'expiry'. When it is evaluated as an integer, it will return 0.

If you want to validate the column expiry from the database, then you should write a query to retrieve that value. Plenty examples to be found right here on DaniWeb.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.