adyre Posted May 22, 2006 Share Posted May 22, 2006 I have something like this:<?$sql = mysql_query("SELECT data, DATE_SUB(data, INTERVAL 20 DAY) - CUR_DATE() as DATAX");while($row = mysql_fetch_array($sql)){print $row['datax'];}?>And it displays somethink like 90 days even if 'data' is the current date......If any of you can help, please do that.....Or any other method so I can display how many days remaining until "data" its 20 days old.I delete them automaticaly if they reach 20 days, but I can't post "X days remaining"...Excuse my English, but I'm from Romania... Quote Link to comment https://forums.phpfreaks.com/topic/10207-php-date-difference/ Share on other sites More sharing options...
Barand Posted May 22, 2006 Share Posted May 22, 2006 [code]SELECT (20 - (TO_DAYS(CURDATE()) - TO_DAYS(data))) AS datax[/code]or[code]SELECT (TO_DAYS(data) + 20 - TO_DAYS(CURDATE()) ) AS datax[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10207-php-date-difference/#findComment-38043 Share on other sites More sharing options...
adyre Posted May 22, 2006 Author Share Posted May 22, 2006 It works perfect... Thanks very much... You don't even know how much you helped me... I've tried so much to figure this out and I haven't found a solutin... 10x Quote Link to comment https://forums.phpfreaks.com/topic/10207-php-date-difference/#findComment-38076 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.