Jump to content

help in this code


seco

Recommended Posts

Hi

i found ths code and im asking if its right

this code check if the product is expired

it subtract the timestamp of today from the end date of the product and divide by 86400 and check if less than zero

- one more thing . why the @ sign needed?

 

(strtotime(date('Y-m-d')) - strtotime(@$row_rsProducts['enddate_prd']))/86400 <0

 

thanks in advance.

Link to comment
Share on other sites

This code snippet subtracts the end date of the product from today's date. If that is less than zero then the product hasn't expired yet. The "@" suppresses error messages. I do not think the "/86400" is necessary here. I would write it as

<?php
$check_exp = time() -  strtotime($row_rsProducts['enddate_prd']);
if ($check_exp < 0)
   echo "Product has expired"
?>

 

Ken

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.