Jump to content

[SOLVED] Expire date not working :(


balkan7

Recommended Posts

i used follow fileds for date start and date expire:

banner_date varchar(100) NOT NULL,

banner_expire varchar(100) NOT NULL,

 

for inserting date i used function time(); in datebase look like this one: (1214930648) same in 2 fields,

but in exipration field i add more time like 1 month whit this function:

 

<?php
$add_date = mktime(date(H),date(i),date(s),date(m) + 1 ,date(d), date(Y));
        $until = date("d-m-Y H:i:s", $add_date);
        $result1 = dbquery("UPDATE ".$db_prefix."btr_banners set banner_expire = '".$add_date."' WHERE banner_id = ".$banner_id."");?>

 

now i used this code for check did banner expire time but not working:

<?php
$time = time();
		if ($data['banner_expire'] < $time) {
			$result3 = dbquery("UPDATE ".$db_prefix."btr_banners set banner_state = '0' WHERE banner_id = '".$banner_id."'");
		}?>

 

can someone help me where i wrong ?

Link to comment
Share on other sites

i use now this function but whitout result :(

<?php
if (isset($_GET['banner_id']) && isNum($_GET['banner_id'])) $banner_id = $_GET['banner_id'];

$expire = dbquery("SELECT * FROM ".$db_prefix."btr_banners WHERE banner_id='$banner_id'");
	while($exp = dbarray($expire)) {
	$time = date("Y-m-d H:i:s");
	if ($exp['banner_expire'] < $time) {
	$result3 = dbquery("UPDATE ".$db_prefix."btr_banners SET banner_state='0' WHERE banner_id='$banner_id'");
	}
}
?>

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.