This topic is locked

Expired items code

8/27/2009 7:51:52 AM
PHPRunner General questions
C
chinwag author

I am trying to redirect users if they try to edit a record that has expired according to the date entered in the DATE field.
It works great, but the <now() includes today as well as all other historic dates and thus is redirecting if DATE = today..... such records havent technically expired. Any ideas what to replace the <now() with?



$strSQL = "select `DATE` from TABLE where ID=".$_REQUEST["editid1"];

$rs = db_query($strSQL,$conn);

$data = db_fetch_array($rs);

if ($data["DATE"]<now())

{

header("Location: other.php");

}

else

{
}
J
Jane 8/27/2009

Hi,
here is a sample:

if (strtotime($data["DATE"])-strtotime("+1 day")<0)
C
chinwag author 8/27/2009



Hi,
here is a sample:

if (strtotime($data["DATE"])-strtotime("+1 day")<0)



FANTASTIC!!! I changed it to

if (strtotime($data["DATE"])-strtotime("-1 day")<0)

and it works. thank you