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); }
?>
forgot 0 Newbie Poster
pritaeas 2,211 ¯\_(ツ)_/¯ Moderator Featured Poster
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.