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!


Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default Quick Variable Question

    How would i make it so it inserts the data into the text file that matches $category.

    like so:
    $read = fopen("$category.txt", "r");
    $contents = fread($read, filesize('$category.txt'));

    but clearly proper way..

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  2. #2
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    I think putting {} around the variable should make it work. so like fopen("{$category}.txt", "r") if that doesn't work, try fopen("".$category.".txt", "r")
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  3. #3
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    Code:
    Warning:  filesize() [function.filesize]: stat failed for ".$category.".txt in /home/chong08/public_html/mini-roberts.com/tim/adddef.php on line 53
    
    Warning:  fread() [function.fread]: Length parameter must be greater than 0 in /home/chong08/public_html/mini-roberts.com/tim/adddef.php on line 53
    Last edited by Colin-Roberts; 11-02-2009 at 09:59 PM.

  4. #4
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    You changed the second line as well yeah?
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  5. #5
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    yep, changed all 3 of them
    Last edited by Colin-Roberts; 11-02-2009 at 10:06 PM.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  6. #6
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Quote Originally Posted by Colin-Roberts View Post
    How would i make it so it inserts the data into the text file that matches $category.

    like so:
    $read = fopen("$category.txt", "r");
    $contents = fread($read, filesize('$category.txt'));

    but clearly proper way..
    PHP Code:
    $read fopen$category '.txt''r' );
    $contents fread$readfilesize$category '.txt' ) ); 

  7. #7
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    well
    PHP Code:
    $read fopen("".$category.".txt""r");
    $contents fread($readfilesize("".$category.".txt")); 
    looks like it should work to me.. i'm not really sure how else to do it..
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  8. #8
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    i'm just going do it all in mysql instead..

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  9. #9
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    Quote Originally Posted by Colin-Roberts View Post
    i'm just going do it all in mysql instead..
    Much easier, nice choice.
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


Posting Permissions

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