proctk Posted November 25, 2006 Share Posted November 25, 2006 Below is the complet function and the string of code that I'm trying to use to calculate a persons age. It not wanting on my web server, for some reason when it gets to the point to exicute the string to calcualte the age the code stops runing. everythingis displayed until this point but nothing after. there are no error message shown either. Any idea why this is happening.Thank you[code=php:0]<?function dateDiff($dformat, $endDate, $beginDate){ $date_parts1=explode($dformat, $beginDate); $date_parts2=explode($dformat, $endDate); $start_date=gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]); $end_date=gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]); return $end_date - $start_date;} ?>[/code][code=php:0]$ownerAge = floor(dateDiff("-", date("Y-m-d"), $dob)/365);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/ Share on other sites More sharing options...
The Little Guy Posted November 25, 2006 Share Posted November 25, 2006 By the code you gave... You never show us when the function is being used.... How do you use it?Example like this:echo dateDiff($value1, $value2, $value3); Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-129960 Share on other sites More sharing options...
akitchin Posted November 25, 2006 Share Posted November 25, 2006 possibly because your error reporting has been turned off. i imagine one of those gregoriantojd() functions is tossing an error for one reason or another. try these lines at the top of your script:[code]ini_set('display_errors', 1);error_reporting(E_ALL);[/code]@Little Guy: unless he edited his post (doesn't appear that he has), his usage example is in plain view at the end of his message. Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130034 Share on other sites More sharing options...
proctk Posted November 25, 2006 Author Share Posted November 25, 2006 I get this error, thank you for showing me how to turn that feature onFatal error: Call to undefined function: gregoriantojd() in /services/webpages/f/a/familyclick.ca/public/familyConfig.php on line 6all my date formats are Y,m,d Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130071 Share on other sites More sharing options...
printf Posted November 25, 2006 Share Posted November 25, 2006 if on Linux/Unix/Mac, you have to configure the calendar extension when you build PHP [b]--enable-calendar[/b], on Windows the extension is part of the core so no configuring needed!printf Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130076 Share on other sites More sharing options...
proctk Posted November 25, 2006 Author Share Posted November 25, 2006 how would I figurethis out. my hosting company is domaindirect. Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130094 Share on other sites More sharing options...
printf Posted November 25, 2006 Share Posted November 25, 2006 You can do...[code]<?phpinfo();?>[/code]But you really don't need to, because PHP has already told you that a function within the Calendar extension is [b]not defined[/b], which means the Calendar extension is not installed because the function [b]gregoriantojd()[/b] has been a member of the Calendar extension since PHP 3, so it wouldn't be a version difference causing the conflict or better said, a function being [b]undefined[/b].So ask your host to install it for you...printf Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130127 Share on other sites More sharing options...
proctk Posted November 26, 2006 Author Share Posted November 26, 2006 anyone recomend a web hosting company Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130342 Share on other sites More sharing options...
JasonLewis Posted November 26, 2006 Share Posted November 26, 2006 why dont you download something like WAMP and have your scripts tested there until you find a host. i dont really no of any good ones because it has been a long time since i have had one... Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130350 Share on other sites More sharing options...
proctk Posted November 26, 2006 Author Share Posted November 26, 2006 I use wampp and my code works on there, only when I up load it do I run ito problems Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130353 Share on other sites More sharing options...
JasonLewis Posted November 26, 2006 Share Posted November 26, 2006 alright, well i suggest you either ask your host to upgrade there php or find a new host.. Quote Link to comment https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130373 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.