Results 1 to 5 of 5

Thread: How to move to next line by PHP in text file?

  1. #1
    Join Date
    May 2011
    Posts
    470

    How to move to next line by PHP in text file?

    I am unable to put a data directly to next line by PHP to the text file I had tried /n, <br/> but it isn’t working. I want that when I am filling the data to a text file from PHP all the first name last name and other detail should go to the next line. What should I do please anyone help me? Or suggest some clue so that I get it done?

  2. #2
    Join Date
    May 2009
    Posts
    529

    Re: How to move to next line by PHP in text file?

    I am not that sure but let me try to help you out of this
    I think you are having 2 problem situations : first situation is every line of yours are not been readed by using FSO and the second problem can be that a newline character is not being viewed as a break.
    What I suggest is this.
    1.) Read all method must be used to view entire string into variable first as
    Read all method: strFile = FSOStream.ReadAll
    2.) Replace all chr(13) with (chr(10),
    strFile = (strFile,chr(13),chr(10))
    3.) Insert string variable (strFile) into your Access memo field.

  3. #3
    Join Date
    May 2009
    Posts
    543

    Re: How to move to next line by PHP in text file?

    Your method of using the /n is correct I think but if you are using Microsoft word then the thing is that it only seems to render new line when the wrap text is set true for that you need to code it in this way,
    Code:
    $objPHPExcel getActiveSheet() setCellValue('A1', "first line\nsecond line");
    $objPHPExcel getActiveSheet()get Style('A1') get Alignment()setWrapText(true);
    Try this out. I had used this once and been got trough with the problem hope you to get it done

  4. #4
    Join Date
    May 2009
    Posts
    511

    Re: How to move to next line by PHP in text file?

    Hello I am not a much user of PHP but still let me guess by saying try /r with something know as split with an array function if you’re /n is not working . It can be used in following manner
    Code:
    Array = split (string, "\r")
    Or even if you want to work with explode with /n try this out
    Code:
    $array = explode ("\n", $your_string_from_db);

  5. #5
    Join Date
    May 2009
    Posts
    637

    Re: How to move to next line by PHP in text file?

    I got your point and it has been a problem with some of the beginners of PHP and I was one of them to and I have tried many of the codes but it dint worked actually I don’t know about what coding you have done and what attempts you have been trying out to I have few suggestions for you let’s try out a bit hope this solves the problem or you need to ask it to some your teacher who can solve your problem by going through your coding anyways that is a later part if this don’t work out
    Code:
    $filecontent. = "$name $age $email $nick $hobby $homepage\n";
    One more suggestion which says the code as written below
    Code:
    $filecontent. = "$name $age $email $nick $hobby $homepage\n\r";

Similar Threads

  1. HELP - add new line in text file without format changed
    By newbie1818 in forum Software Development
    Replies: 2
    Last Post: 13-09-2011, 05:17 PM
  2. Assign each line of a text file to a variable
    By hitman126 in forum Operating Systems
    Replies: 1
    Last Post: 22-01-2011, 07:42 AM
  3. Unable to move to the next line in c++ program
    By Madaleno in forum Software Development
    Replies: 5
    Last Post: 09-02-2010, 09:18 PM
  4. How to let Java read text file line by line.
    By Visala28 in forum Software Development
    Replies: 3
    Last Post: 04-08-2009, 11:30 PM
  5. how can i move Line in graphique with keyboard
    By manjava in forum Software Development
    Replies: 3
    Last Post: 17-11-2008, 09:26 PM

Tags for this Thread

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
  •  
Page generated in 1,714,114,251.10261 seconds with 16 queries