PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 16th, 2012, 09:40 AM
DavidPr DavidPr is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 98 DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 15 sec
Reputation Power: 8
Another Date Question

PHP 5 and MySQL 5

In query:
PHP Code:
 DATE_FORMAT(submitted'%m/%d/%y') AS date 

In page:
PHP Code:
 $date stripslashes($row['date']);
$originaldate $date
$ageindays number_format(floor((date("U")-strtotime($originaldate))/86400),0);
$torenew 180 $ageindays;
echo 
"Renew in $torenew days."

This worked fine prior to PHP 5 but now it doesn't. Not sure how I should adjust this to get it working. Any help appreciated.

Reply With Quote
  #2  
Old November 16th, 2012, 09:51 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,907 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Month 9 h 4 m 10 sec
Reputation Power: 581
"Not sure how to adjust this to get it working" either because I have no idea what " but now it doesn't" means.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old November 16th, 2012, 10:00 AM
DavidPr DavidPr is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 98 DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 15 sec
Reputation Power: 8
Sorry, I forgot to mention what I was trying to accomplish. It's a resume program. The date a person enters their resume is logged in the database under the "submitted" row.

When they login to their resume panel I want to let them to see how many days they have left before their resume will become inactive (6 months total active time from original submit date) and will have to be renewed. The script I posted above worked fine before my hosting company installed PHP 5 and MySQL 5, so I'm assuming that something in this:
Quote:
$ageindays = number_format(floor((date("U")-strtotime($originaldate))/86400),0);
is no longer valid, but I don't know what.

Reply With Quote
  #4  
Old November 16th, 2012, 10:06 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,907 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Month 9 h 4 m 10 sec
Reputation Power: 581
So what is the error message? I'm trying to help but you really need to understand that clairvoyance not my strong suit.

Reply With Quote
  #5  
Old November 16th, 2012, 10:27 AM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Sarcky
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,917 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 1 Day 10 h 25 m 30 sec
Reputation Power: 6113
You don't need stripslashes, and there's no reason to use date_format to format a date to a m/d/Y only to pass it to strtotime to format it to a unix timestamp, do math on it, then translate it back into a number of days. You could do all this math right in the query using NOW() and UNIX_TIMESTAMP()
__________________
HEY! YOU! Read the New User Guide and Forum Rules

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

Reply With Quote
  #6  
Old November 16th, 2012, 11:38 AM
DavidPr DavidPr is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 98 DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level)DavidPr User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 15 sec
Reputation Power: 8
I used
Quote:
DATEDIFF(NOW(),submitted) AS datediff
Then it was simply a matter of subtracting the datediff number from 180 (6 months).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Another Date Question

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap