Page 1 of 1

newline in textarea

Posted: Sun Dec 22, 2002 10:18 am
by stickman373
How do i start a new line when printing to a textarea?

i Have this code:

Code: Select all

<?php $db = mysql_connect("localhost",$username,$password);
					mysql_select_db($database,$db);
					$query2 = "SELECT * FROM postnew ORDER BY id ASC"; 
					$result2 = mysql_query($query2); 
					while ($row = mysql_fetch_array($result2)) { 
			     	 echo '[b]Nick:[/b] '.$row['nick'].'     [b]Posted:[/b] '.$row['count'];
					 } mysql_free_result($result2);  ?>
So it goes through and gets all the nicknames and puts them along with their count, yet they are printed right next to each other i want them to print each nickname on a line of a textarea

how?

Posted: Sun Dec 22, 2002 10:33 am
by Rendez Vous
You need to use the New Line delimiter, which is \n, but you must place it within double quotes, so try the following:

Code: Select all

<?php
$db = mysql_connect("localhost",$username,$password); 
mysql_select_db($database,$db); 
$query2 = "SELECT * FROM postnew ORDER BY id ASC";  
$result2 = mysql_query($query2);  
while ($row = mysql_fetch_array($result2)) {  
echo "Nick: ".$row['nick']."     Posted: ".$row['count']."\n"; 
}
mysql_free_result($result2); 
?>
?>

Posted: Sun Dec 22, 2002 10:44 am
by stickman373
thanks a lot :o