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 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Notice: Use of undefined constant minutes - assumed 'minutes'

    I have been developing a webapp and it worked fine on the site I was developing on, but when I test-installed it on the client machine, I got these errors:

    Notice: Use of undefined constant minutes - assumed 'minutes' in
    C:\wamp\www\HLearn\makeappt.php on line 56

    Notice: Use of undefined constant hours - assumed 'hours' in
    C:\wamp\www\HLearn\makeappt.php on line 60

    Notice: Use of undefined constant hours - assumed 'hours' in
    C:\wamp\www\HLearn\makeappt.php on line 61

    Notice: Use of undefined constant hours - assumed 'hours' in
    C:\wamp\www\HLearn\makeappt.php on line 64

    The code for that part is using php's getdate() function.

    PHP Code:
    <?php
    ...
    //Information for the appointment form:
       
    $date getdate();
       
    $minutes $date[minutes]; 
        if (
    $minutes<10) {
        
    $minutes "0" $minutes;
        }
        if (
    $date[hours]<12) {
            if (
    $date[hours] == 0) {
        
    $time_called "1" ":" $minutes "AM"; }
            else {
        
    $time_called $date[hours] . ":" $minutes "AM";
            }
        }
        else {
            if ((
    $date[hours] == 23) && ($minutes >0)) {
        
    $time_called "12" ":" $minutes "AM";}
            else {
        
    $time_called $date[hours]-12 ":" $minutes "PM"; }
        }
       
    //print $date[mon] . "/" . $date[mday] . "/" . $date[year];
    ...
       
    ?>
    I believe they have the latest version of PHP.
    Why would this change?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Try enclosing all your array indexes by quotes, like
    PHP Code:
    $date['minutes'], $date['hours'etc 
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder kokjj87's Avatar
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    279
    Thanks
    1
    Thanked 55 Times in 54 Posts
    You miss out the quote..
    Change
    PHP Code:
    $minutes $date[minutes];
    $date[hours]; 
    To
    PHP Code:
    $minutes $date["minutes"];
    $date["hours"]; 


  •  

    Tags for this Thread

    Posting Permissions

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