Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    reading text file?

    hi,
    thought this would be simple,

    my code:
    PHP Code:

    $filename 
    "../ads/ads.txt";
    $txtmp fopen($filename,"a+");

    echo 
    "<textarea>$txtmp</textarea>"
    at the moment, just trying to pull a text file into a form/textarea to reading,
    but that code just gives me:

    Resource id #3

    what have i don't wrong?

    thanks in advance for your time!
    -Ken

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,172
    Thanks
    19
    Thanked 65 Times in 64 Posts
    $txtmp is the file, not the contents of the file subtle difference
    What you want is readfile

  • #3
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    also look at file_get_contents


  •  

    Posting Permissions

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