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 Quote 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. Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/58528-solved-expire-banner/#findComment-290321 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.