php new bie Posted December 16, 2008 Share Posted December 16, 2008 hello , i don't know if it is mysql or php or html issue , i have php script that do mysql Query and post the result into textarea . so when i make connection to DB and Query username and email in format $query = "SELECT * FROM USERINFO "; and fetching the row into the appropriate columns name , the output in the textarea field appears with NO new line "\n". $result = $row['username'] .";". $row['email'] ; Then : echo $result."\n"; output like this : --- textarea --- username1:email1username2:email2 ...etc --- / textarea --- while i need : --- textarea --- username1:email1 username2:email2 --- / textarea --- then i try : $result = $row['username'] .";". $row['email'] ."\n" ; then echo the result same problem no break .. any help ? Link to comment https://forums.phpfreaks.com/topic/137139-mysql-output-in-textarea/ Share on other sites More sharing options...
trq Posted December 16, 2008 Share Posted December 16, 2008 Are you trimming the newline char before insertion? Link to comment https://forums.phpfreaks.com/topic/137139-mysql-output-in-textarea/#findComment-716363 Share on other sites More sharing options...
php new bie Posted December 16, 2008 Author Share Posted December 16, 2008 I am just showing the username:email fields into a textarea output , the problem is formating the result through the textarea to make every row in new line . without textarea i use echo "<PRE>"; echo $result ; echo "</PRE>"; or just echo $result . "<br / >"; and that works fine . but when the result appears through <textarea> it is not in a neat format . Link to comment https://forums.phpfreaks.com/topic/137139-mysql-output-in-textarea/#findComment-716372 Share on other sites More sharing options...
trq Posted December 16, 2008 Share Posted December 16, 2008 I'm asking if your sure your saving the newline chars to the database on the way in? They should display without any problem on the way out as long as they haven't been removed. Link to comment https://forums.phpfreaks.com/topic/137139-mysql-output-in-textarea/#findComment-716376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.