Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

php redirect issue


  • Please log in to reply
No replies to this topic

#1 guitarzRus

guitarzRus

  •  Avatar image
  • Members
  • 30 posts
  • OFFLINE
  •  
  • Local time:01:43 PM

Posted 10 April 2022 - 05:34 PM

 

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

 

 

 



BC AdBot (Login to Remove)

 





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users