Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. How to write in next line

How to write in next line

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
tutorialcomhelpquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    udch
    wrote on last edited by
    #1

    $s=file('http://www.abc.com/d.txt'); $size=count($s); $ud = fopen("yaka.txt","w"); for($x=0;$x<$size;$x++) { $line =trim($s[$x]); fwrite($ud, $line); } I want to write in next line.how to do this. Example :- data is in .txt file 12,54,45 78,87,96 23,54,64 and i also want in same format but i am getting like this.... 12,54,4578,87,9623,54,64 What to do ? help me

    A F 2 Replies Last reply
    0
    • U udch

      $s=file('http://www.abc.com/d.txt'); $size=count($s); $ud = fopen("yaka.txt","w"); for($x=0;$x<$size;$x++) { $line =trim($s[$x]); fwrite($ud, $line); } I want to write in next line.how to do this. Example :- data is in .txt file 12,54,45 78,87,96 23,54,64 and i also want in same format but i am getting like this.... 12,54,4578,87,9623,54,64 What to do ? help me

      A Offline
      A Offline
      Adam Maras
      wrote on last edited by
      #2

      udch wrote:

      fwrite($ud, $line);

      I may be rusty on my PHP, but I believe what you need to do is add a newline character to each line after you fwrite it. Perhaps something like this?

      fwrite($ud, $line . "\n");

      Adam Maras | Software Developer Microsoft Certified Professional Developer

      U 1 Reply Last reply
      0
      • A Adam Maras

        udch wrote:

        fwrite($ud, $line);

        I may be rusty on my PHP, but I believe what you need to do is add a newline character to each line after you fwrite it. Perhaps something like this?

        fwrite($ud, $line . "\n");

        Adam Maras | Software Developer Microsoft Certified Professional Developer

        U Offline
        U Offline
        udch
        wrote on last edited by
        #3

        Thanks for your help brother but it is not working it is only adding [] something like this may be space because it is not visible here.Thanks again for you help bro.

        P 1 Reply Last reply
        0
        • U udch

          $s=file('http://www.abc.com/d.txt'); $size=count($s); $ud = fopen("yaka.txt","w"); for($x=0;$x<$size;$x++) { $line =trim($s[$x]); fwrite($ud, $line); } I want to write in next line.how to do this. Example :- data is in .txt file 12,54,45 78,87,96 23,54,64 and i also want in same format but i am getting like this.... 12,54,4578,87,9623,54,64 What to do ? help me

          F Offline
          F Offline
          fly904
          wrote on last edited by
          #4

          fwrite($ud, $line . "\r\n");

          If at first you don't succeed, you're not Chuck Norris.

          U 1 Reply Last reply
          0
          • F fly904

            fwrite($ud, $line . "\r\n");

            If at first you don't succeed, you're not Chuck Norris.

            U Offline
            U Offline
            udch
            wrote on last edited by
            #5

            Thanks again For you help brother your code is working.

            1 Reply Last reply
            0
            • U udch

              Thanks for your help brother but it is not working it is only adding [] something like this may be space because it is not visible here.Thanks again for you help bro.

              P Offline
              P Offline
              parth_patel
              wrote on last edited by
              #6

              Which file viewer are you using ?

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups