Jump to content

mysql output in textarea


php new bie

Recommended Posts

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

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 .

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.