Jump to content

[SOLVED] Expire banner


web_master

Recommended Posts

Hi,

 

I upload the banner, and in dbase I have columns:

 

`banner_year` (examlpe: 2007)

`banner_month` (example: 08)

`banner_day` (example: 24)

 

I want to banner expire 24. avgust 2007. (mean that 25. august I can see anymore that banner)

 

query is:

 

$query_banner = mysql_query("SELECT * FROM `banner` WHERE `banner_year` >= '".date("Y")."' AND `banner_month` >= '".date("m")."', `banner_day` >= '".date("d")."' ORDER BY `banner_order` ASC");

 

BUT its not good? because I need to look month and day together, not separately...

 

Please help me...

 

thnxs

 

Link to comment
https://forums.phpfreaks.com/topic/58528-solved-expire-banner/
Share on other sites

metrostars, youre great!

 

$query_return = mysql_query("INSERT INTO `banner` (
	`banner_link`,
	`banner_date`,
	`banner_datetime`,
	`banner_ip`
	)
	VALUES (
	'".$_POST['banner_link']."',
	'".$_POST['banner_year'].$_POST['banner_month'].$_POST['banner_day']."',
	'".date("Y-m-d H:i:s")."',
	'".getenv("REMOTE_ADDR")."'
	)");

 

Query return:

 

$query_banner = mysql_query("SELECT * FROM `banner` WHERE `banner_date` >= '".date("Ymd")."' AND `banner_onoff` = '1' ORDER BY `banner_order` ASC");

 

Its work perfectly!

 

THANX!

Link to comment
https://forums.phpfreaks.com/topic/58528-solved-expire-banner/#findComment-290321
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.