Results 1 to 2 of 2

Thread: Please count my penguins.

  1. #1
    Join Date
    Feb 2007
    Location
    🌎
    Posts
    528
    Thanks
    10
    Thanked 10 Times in 10 Posts
    Blog Entries
    2

    Angry Please count my penguins.

    I wrote a script (with a tutorial) to count my penguins.
    PHP Code:
    //check if the form has been submitted
    if(isset($_POST['submit'])){
    //try to open the file
    if($fp=fopen('penguins.txt','a+')){
    flock($fpLOCK_EX);
    //write to the file
    $fp3 $_POST['thename'];
    $fp2 $fp+$fp3;
    fwrite($fp2"n");
    flock($fp,LOCK_UN);
    fclose($fp);
    //inform user that the writing was a success
    echo "You have ".$fp2." penguins now.";
    }else{
    echo 
    "There was an error, could not store the penguin.";
    }
    }
    $fp4=fopen('penguins.txt','a+');
    echo 
    "You have ".$fp4." penguins."
    But for some reason, I ALWAYS HAVE 3 PENGUINS.
    ....(o_ Penguins
    .---/(o_- techno_racing
    +(---//\-' in
    .+(_)--(_)' The McMurdo 500

  2. #2
    Join Date
    Feb 2007
    Location
    🌎
    Posts
    528
    Thanks
    10
    Thanked 10 Times in 10 Posts
    Blog Entries
    2

    Default

    And the script resets itself to RESOURCE ID #2 PENGUINS when I run it.
    ....(o_ Penguins
    .---/(o_- techno_racing
    +(---//\-' in
    .+(_)--(_)' The McMurdo 500

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
  •