I have a problem to display properly a text using PHP.
The row 'content' of the MySQL database contains this :
Item1 : value1
Item2 : value2
Item3 : value3
Total value
So I do a foreach like this :
foreach($connection->query('SELECT * FROM table') as $row)
And I display the content like this :
echo $row['content'];
But it returns a result like this :
Item1 : value1 Item2 : Value2 Item3 : Value3 Total value
And I would like to display it with one item per line, not all the items on the same line.
Thanks !
You need to use nl2br
which replaces line breaks with <br>
echo nl2br($row['content']);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments