Include error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neoblackviper
    New Member
    • Jan 2008
    • 7

    Include error

    ok i have added a include as i do to all over pages playing around with some date manipulation

    [PHP]
    <?php
    ini_set("displa y_errors", 1);
    include('datead d.php');


    $temptime = time();
    echo strftime('%Hh%M %A %d %b',$temptime);
    echo "<br />";
    echo $temptime;
    $temptime = DateAdd('n',50, $temptime);
    echo "<br />";
    echo strftime('%Hh%M %A %d %b',$temptime);
    echo "<br />";
    echo $temptime;

    ?>
    [/PHP]

    and in the included file
    [PHP]<?php

    function DateAdd($interv al, $number, $date) {



    $date_time_arra y = getdate($date);

    $hours = $date_time_arra y['hours'];

    $minutes = $date_time_arra y['minutes'];

    $seconds = $date_time_arra y['seconds'];

    $month = $date_time_arra y['mon'];

    $day = $date_time_arra y['mday'];

    $year = $date_time_arra y['year'];



    switch ($interval) {



    case 'yyyy':

    $year+=$number;

    break;

    case 'q':

    $year+=($number *3);

    break;

    case 'm':

    $month+=$number ;

    break;

    case 'y':

    case 'd':

    case 'w':

    $day+=$number;

    break;

    case 'ww':

    $day+=($number* 7);

    break;

    case 'h':

    $hours+=$number ;

    break;

    case 'n':

    $minutes+=$numb er;

    break;

    case 's':

    $seconds+=$numb er;

    break;

    }

    $timestamp= mktime($hours,$ minutes,$second s,$month,$day,$ year);

    return $timestamp;

    }

    ?>[/PHP]

    my link is http://hash-dict.com/test/atest.php any ideas?
  • stepterr
    New Member
    • Nov 2007
    • 157

    #2
    Is the actual include file called dateadd.php and in the same exact case? PHP is case sensitive and if it doesn't match it will cause you problems. I'm thinking it has to be something along those lines since it can't find your function at all. Either that or it's not in the same directory.

    Comment

    • neoblackviper
      New Member
      • Jan 2008
      • 7

      #3
      Actually it is there case wise you can see it when you visit the page it loads it with the question mark squares.

      Also they are copy past from there files and the file names are all in lower case . both of the files are in the directory called /test/ in my web server

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Have you tried copying the contents of the include file and pasting it into the time manipulation page to see if that works?

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5


          Take a look... the page isn't being parsed as PHP.

          Comment

          • neoblackviper
            New Member
            • Jan 2008
            • 7

            #6
            yes that does work and i have even stored it as a .inc and a text file to include and adjusted the scripts accordingly.

            Comment

            • neoblackviper
              New Member
              • Jan 2008
              • 7

              #7
              hmm it seems to work on other Lamp systems..

              im going to redo my install and see if that will work.

              Comment

              Working...