Display a multiline text properly from MySQL with PHP

Antonin P

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 !

The Codesee

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

PHP display text from MYSQL

From Dev

how to display multiline text retrived from db

From Dev

gujarati fonts not display properly from mysql database

From Dev

Component to display multiline text in Delphi

From Dev

PHP while loop to read multiline text from string

From Dev

How to display the largest number from a text file properly?

From Dev

How to Display output from MYSQL Full-Text query in PHP using Foreach

From Dev

Display only formatted text from mysql database

From Dev

Display text from a mysql table like a array

From Dev

PHP display long text from PostgreSQL

From Dev

Multiline UILabel doesn't display properly on automatic UITableViewCell

From Dev

Display values from php mysql array separately

From Dev

PHP display image BLOB from MySQL

From Dev

display multiple rows from mysql in a php function

From Dev

Display reformatted date from MySQL in PHP

From Dev

Trying to display from mySQL using a class in php

From Dev

Display an image from a MySQL database using PHP

From Dev

How to I display image from mysql PHP

From Dev

display array of items from DB php/MySQL

From Dev

PHP MySQL display image from database

From Dev

display multiple rows from mysql in a php function

From Dev

Display data from two tables - PHP mySQL

From Dev

Using PHP, get data from MySQL and display it

From Dev

Display an image from a MySQL database using PHP

From Dev

Display reformatted date from MySQL in PHP

From Dev

Display values from php mysql array separately

From Dev

how to display image from mysql in php

From Dev

Display specific PHP array from MySQL

From Dev

Display Upcoming Events with PHP from MySQL query

Related Related

HotTag

Archive