Advanced Search

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: PHP Not Loading TXT File That Has A Single Digit Number

  1. #1
    Join Date
    Jul 2011
    Posts
    53
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default PHP Not Loading TXT File That Has A Single Digit Number

    For some reason when PHP tries to read a TXT file that has a single digit in it (like 1), it won't read it. The page will just sit there loading for like ten minutes and when it's "done" the whole page isn't fully loaded.

    Is there a way to fix this? I've tried reading the TXT file and checking if it's a single digit and displaying the number from the TXT file with a zero in front but that doesn't work either.

    Thanks in advanced!

    - M2com

  2. #2
    Join Date
    Sep 2008
    Location
    Midland, Texas
    Posts
    52
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default

    Can you post the code?

  3. #3
    Join Date
    Jul 2011
    Posts
    53
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Here is the code:

    <?php $file1=$_SESSION['username'] . '/file.txt';
    if (file_exists($file1))
    {
    $file = fopen($file1, "r");
    while (!feof($file))
    {
    $display = fgets($file, filesize($file1));
    echo $display . "
    ";
    }
    fclose($file);
    }
    else
    {
    echo "File could not be opened. Please report this to the admin.";
    }
    ?>

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Are you using PHP 5 or a lower version?
    Corrections to my coding/thoughts welcome.

  5. #5
    Join Date
    Jul 2011
    Posts
    53
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I am using a lower version. I'm not sure which though.

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    <?php phpinfo(); ?>

    Easy to find out.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Jul 2011
    Posts
    53
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    The version I'm using is v4.4.4. If I need the latest version, how do I install it? I have downloaded the current one but how to I finally install it?

    Thanks!

  8. #8
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

  9. #9
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    He has it downloaded so just need http://php.net/manual/en/install.php
    Corrections to my coding/thoughts welcome.

  10. #10
    Join Date
    Jul 2011
    Posts
    53
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I'm still not getting how to install PHP 5. All the instructions I've looked at are either installing it on your own web server (like localhost or something) or something totally different....

    Thanks for your help already!

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
  •