SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot zoso's Avatar
    Join Date
    Aug 2005
    Location
    Earth..
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Taking a file pointer to next line.

    I want to write to a file.
    fwrite($handle,"string1");fwrite($handle,$string2);works but it starts writing string2 on the same line .I want to write $string2 on the next line.
    One way is to close and open the file again.But that would mean opening and closing a lot of time in a loop.
    Any other methods?

  2. #2
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    fwrite($handle,"\n"); 

  3. #3
    SitePoint Zealot zoso's Avatar
    Join Date
    Aug 2005
    Location
    Earth..
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks.
    I have another problem
    Code:
    echo "<br>here";
    		write2file();
    		echo "<br>hiiiii";
    It simply doent call the function.
    it echoes here but doesnt echo hiiii.
    Please help.

  4. #4
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to post the script.

  5. #5
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    write2file() is an undefined function.


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
  •