seco Posted April 5, 2008 Share Posted April 5, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/99679-help-in-this-code/ Share on other sites More sharing options...
kenrbnsn Posted April 5, 2008 Share Posted April 5, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/99679-help-in-this-code/#findComment-509944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.