Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Dec 2007
    Posts
    2,807
    Tokens
    0

    Latest Awards:

    Default Simple PHP Problemo

    Can anyone see anything wrong with this? A number is sent to the file from an application but the PHP isnt saving it to the text file like it should >.<

    PHP Code:
    <?php 
    $num 
    $_POST [&#8216;MyNumber’]; 
    $myFile = &#8220;lol.txt”; 
    $fh fopen($myFile, &#8216;w’) or die(“can’t open file”); 
    fwrite($fh"My Number is: "); 
    fwrite($fh$num); 
    fclose($fh); 
    ?>
    Edit by Robbie! (Forum Super Moderator): Moved to Coding Help, please post in the correct section next time. Thanks!
    Last edited by Robbie; 26-03-2009 at 07:18 PM.

  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Permissions maybe?
    Hi, names James. I am a web developer.

  3. #3

    Default

    Besides the fact it looks like it's formated with a word processor and not a text editor - no. If that's your actual code, you should be using double quotes and single quotes " and ' and not the other variations such as “” and ‘’. Otherwise the only other thing I can suggest is ensure that the name of the input being submited is exactly "MyNumber" as it's case sensitive.

  4. #4
    Join Date
    Jan 2009
    Posts
    159
    Tokens
    0

    Default

    Hmm it could be a permission error like Protege said, is the file's permissions 0777? If not try changing it to that, and like Iszak said instead of using “” and ‘’ try using "" and '' like so:

    PHP Code:
    <?php 
    $num 
    $_POST ['MyNumber']; 
    $myFile "lol.txt"
    $fh fopen($myFile'w') or die("can't open file"); 
    fwrite($fh"My Number is: "); 
    fwrite($fh$num); 
    fclose($fh); 
    ?>
    If that doesn't work then I cannot suggest anything else eithier, is that the full code? If so then I'm not sure sorry.

  5. #5
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    u *REMOVED* repeating lyk

    wat me and blutak said!?

    Edit by Robbie! (Forum Super Moderator) - Please do not avoid the filter/use inappropriate language.
    Last edited by Robbie; 26-03-2009 at 07:12 PM.
    Hi, names James. I am a web developer.

  6. #6
    Join Date
    Jan 2009
    Posts
    159
    Tokens
    0

    Default

    Quote Originally Posted by Protege View Post
    u *REMOVED* repeating lyk

    wat me and blutak said!?

    Edit by Robbie! (Forum Super Moderator) - Please do not avoid the filter/use inappropriate language.
    I was explaining it in abit more detail for him, and it's pretty obvious that to make a file readable, it needs to have the permissions of 0777, anyone with half a brain knows that, that was my first thoughts wether you had posted it or not.
    Last edited by Joshh; 27-03-2009 at 09:40 AM.

  7. #7
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Yeah, and you're suppose to read everyone elses replies. It might help you and Habboxs poor database of semi-duplicate results.
    Hi, names James. I am a web developer.

  8. #8
    Join Date
    Jan 2009
    Posts
    159
    Tokens
    0

    Default

    Quote Originally Posted by Protege View Post
    Yeah, and you're suppose to read everyone elses replies. It might help you and Habboxs poor database of semi-duplicate results.
    I'll bare that in mind.. :8

  9. #9
    Join Date
    Jan 2009
    Posts
    159
    Tokens
    0

    Default

    It was extremely mature to whoever -REPPED me btw.

    Edit by Robbie! (Forum Super Moderator): Please do not double post without adding extra information.
    Last edited by Robbie; 29-03-2009 at 02:39 PM.

  10. #10
    Join Date
    Feb 2009
    Location
    London
    Posts
    935
    Tokens
    100
    Habbo
    Sameer!

    Latest Awards:

    Default

    I think it's permissions......

Page 1 of 2 12 LastLast

Posting Permissions

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