bofett Posted January 13, 2009 Share Posted January 13, 2009 Hello all, I am a newbie that knows just enough to break things. My site is currently throwing an error. With this error, I am thinking it may be related to my hosting providers version of PHP or that they are running PHP as CGI (Dreamhost). Any help is much appreciated. Error: Fatal error: Call to a member function stamp() on a non-object ... Code: function adddays($interval,$mm,$dd,$yy,$hh=0,$min=0,$sec=0){ ERROR LINE-----> return $that->stamp($mm,($dd+$interval),$yy,$hh,$min,$sec); Quote Link to comment https://forums.phpfreaks.com/topic/140700-fatal-error-call-to-a-member-function-stamp-on/ Share on other sites More sharing options...
premiso Posted January 13, 2009 Share Posted January 13, 2009 That stamp is part of a custom class. Not sure how $that is defined/used, maybe it should be $this instead? Unsure we need more code to help you. Quote Link to comment https://forums.phpfreaks.com/topic/140700-fatal-error-call-to-a-member-function-stamp-on/#findComment-736400 Share on other sites More sharing options...
bofett Posted January 14, 2009 Author Share Posted January 14, 2009 Thanks for the response. Here is more... class fptime{ function fptime(){ return 1; } function mytime($stamp="",$format="m/d/Y"){ return date( $format,($stamp ? $stamp : time()) ); } function stamp($mm,$dd,$yy,$hh=0,$min=0,$sec=0){ return mktime($hh,$min,$sec,$mm,$dd,$yy); } function subhours($interval,$mm,$dd,$yy,$hh,$m,$s){ return $that->stamp( $mm,$dd,$yy,($hh-$interval),$m,$s ); } function addhours($interval,$mm,$dd,$yy,$hh,$m,$s){ return $that->stamp( $mm,$dd,$yy,($hh+$interval),$m,$s ); } function subdays($interval,$mm,$dd,$yy){ return $that->stamp($mm,($dd-$interval),$yy); } function adddays($interval,$mm,$dd,$yy,$hh=0,$min=0,$sec=0){ return $that->stamp($mm,($dd+$interval),$yy,$hh,$min,$sec); } function submonths($interval,$mm,$dd,$yy){ return $that->stamp( ($mm-$interval),$dd,$yy ); } function addmonths($interval,$mm,$dd,$yy){ return $that->stamp( ($mm+$interval),$dd,$yy ); } function subyears($interval,$mm,$dd,$yy){ return $that->stamp( $mm,$dd,($yy-$interval) ); } function addyears($interval,$mm,$dd,$yy){ return $that->stamp( $mm,$dd,($yy+$interval) ); } function DateDiff ($interval, $date1,$date2) { // get the number of seconds between the two dates $timedifference = $date2 - $date1; switch ($interval) { case "w": $retval = $timedifference/604800; $retval = floor($retval); break; case "d": $retval = $timedifference/86400; $retval = floor($retval); break; case "h": $retval = $timedifference/3600; $retval = floor($retval); break; case "n": $retval = $timedifference/60; $retval = floor($retval); break; case "s": $retval = floor($timedifference); break; } return $retval; } Quote Link to comment https://forums.phpfreaks.com/topic/140700-fatal-error-call-to-a-member-function-stamp-on/#findComment-736784 Share on other sites More sharing options...
premiso Posted January 14, 2009 Share Posted January 14, 2009 If I am not mistaken, $that should be $this. Also please use the [ code] and [ /code] tags (no initial space). Quote Link to comment https://forums.phpfreaks.com/topic/140700-fatal-error-call-to-a-member-function-stamp-on/#findComment-736971 Share on other sites More sharing options...
bofett Posted January 14, 2009 Author Share Posted January 14, 2009 That seems to work! Thank you for you help premiso. I really appreciate it. If I am not mistaken, $that should be $this. Also please use the [ code] and [ /code] tags (no initial space). Quote Link to comment https://forums.phpfreaks.com/topic/140700-fatal-error-call-to-a-member-function-stamp-on/#findComment-737010 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.