Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 09-06-2011
Member
 
Join Date: May 2011
Posts: 468
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?
Reply With Quote
  #2  
Old 09-06-2011
Member
 
Join Date: May 2009
Posts: 525
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.
Reply With Quote
  #3  
Old 09-06-2011
Member
 
Join Date: May 2009
Posts: 533
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
Reply With Quote
  #4  
Old 09-06-2011
Member
 
Join Date: May 2009
Posts: 503
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);
Reply With Quote
  #5  
Old 09-06-2011
Member
 
Join Date: May 2009
Posts: 620
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";
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 11:41 PM.