If i generate HTML data from MySQL using PHP like this:
/* SQL query */
while ($result = mysql_fetch_object($sql_query) {
$text = $result->table_text;
}
If i echo the result to a textarea I get correct line breaks that the user has entered in a previous <form>. For example
Code:
<textarea>$text</textarea>
Result:
These
are
row breaks
But if I echo the result to a <div> everything comes out to one line.
Code:
<div>$text</div>
Result:
These are row breaks
If I run the query in command line, it seem’s to output the row breaks. But how can I generate them in a div?
Use nl2br function