web_master Posted July 5, 2007 Share Posted July 5, 2007 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 More sharing options...
metrostars Posted July 5, 2007 Share Posted July 5, 2007 You should just convert the year, month and day fields to banner_Date and then just make the current date be bigger than the date in the table for it to not show. Link to comment https://forums.phpfreaks.com/topic/58528-solved-expire-banner/#findComment-290309 Share on other sites More sharing options...
web_master Posted July 5, 2007 Author Share Posted July 5, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.