SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    usa
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Script seems to not work

    Hello all this si the same person who had the problem with the if statement. I'm here again beause now when I close up the if statment and add a elseif it wont work. If you don't understand me maby this code will help you.

    <?php
    include("updates/titlebarnewc.php");
    //Date Configuration
    $date = date("d");
    $day = date("D");
    $hour = date("H");
    $min = date("i");
    $year = date("y");
    //text files which contain update
    //Update Coding
    if (($day == "Sat") && ($date == "27")):
    include("updates/titlebarnewc.php");
    echo "$titlebar1";
    $file=fopen ("updates/titlebaroldc.php","w+");
    fputs($file, "<?php ");
    fputs($file, "\$titlebar1=\"$titlebar2\"; ");
    fputs($file, "?>");
    fclose($file);
    endif;
    if (($day == "Sun") && ($date == "28")):
    include("updates/titlebarnewc.php");
    echo "$titlebar3";
    $file=fopen ("updates/titlebaroldc.php","w+");
    fputs($file, "<?php ");
    fputs($file, "\$titlebar1=\"$titlebar1\"; ");
    fputs($file, "?>");
    fclose($file);
    echo "$titlebar3";
    endif;
    ?>

    If you know what the problem is please help me. Thank you

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Shouldn't a if-statement contain a { after the if (condition), and a } after the entire statement?

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As freaksid will tell you:

    This code uses the alternative control structure syntax:
    http://www.php.net/manual/en/control...ive-syntax.php
    I think it is easier to keep "control" of if statements using curly braces

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


Bookmarks

Posting Permissions

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