I need help re. redirection

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile: Will you tell what I'm doing wrong. It goes straight to "expiredpage.html" even though the value of "expiry" is 360. I keep studying redirection and variable definition but nothing works. It does update.

<?php
$link = mysqli_connect("localhost", "root", "", "prerentdb"); 
// Check connection
if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }

$id='id';
$expiry='expiry';

$sql = "UPDATE numbers 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); }

if ($expiry == 0) { 
header("location:expiredpage.html");
// window.location.href = 'expiredpage.html';
// $(location).attr('href', 'expiredpage.html')
 } 

else  { 
 header("location:sysnav.html");
//window.location.href = 'sysnav.html';
//  $(location).attr('href', 'sysnav.html')
 } 
// Close connection
mysqli_close($link);
?>