Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11

Thread: Weird Error

  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Weird Error

    With this code
    PHP Code:
    <?php
    $month 
    date(n);
    $year date(Y);
    $actualmonth date(F);
    $today date("l, F d, Y");
    $num cal_days_in_month(CAL_GREGORIAN$month$year);
    echo 
    "There are $num days in $actualmonth $year";
    ?>
    I get an error on line six. Fatal error: Call to undefined function: cal_days_in_month(). I run the same code from one domain, it works fine. The other domain, it doesn't. This is strange. Anyone know why?
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Well since that function is avaialable in PHP >= 4.1 then my guess would be that the server you are running it on where it doesn't work has an older version of PHP.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    What version of php do you have on the server it's not working on? It'll only work on 4.1.0 >

    heh, fancy seeing you here le spook
    Last edited by Nightfire; 10-01-2003 at 10:25 PM.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why not use date('t') instead? That will give you the number of days in a month, the calendar functions are useful if you want to go beyond the UNIX epoch.

    About your problem: It could also be that Calendar support was not compiled in. Check your phpinfo settings to make sure it's actually compiled into PHP.
    De gustibus non est disputandum.

  • #5
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm have PHP Version 4.2.3 on my server....
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Are you running both domains on the same server? The domain name will have no effect on this whatsoever.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #7
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually the one that isn't working is my www.net-riches.com

    The one that is working is the one running on my local machine...
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #8
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Is calendar support enabled on your host? *de javu* Check your phpinfo *de javu #2*

  • #9
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Ok are you running PHP >= 4.1 on the server where this is not working?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #10
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm running 4.2.3 on the server that it isnt working...
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #11
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    as mentioned already ...

    PHP Code:
    <?php
    if( !extension_loaded'calendar' ) ){
        echo 
    'Calendar fuctions not available on in this build' ;
    }else{
                    echo 
    'Calendar functions available';
    }
    <?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •