How to skip line after comma of a variable stored in the Mysql database

Asked

Viewed 86 times

-2

In the view.php file, I need to display a field that is already stored in database, of the type sweep, but when displaying I want the text to be shown skipping lines when finding the comma character (,). Example:

Text stored in variable in Database:
Poem is a textual genre divided into stanzas and verses, each stanza consists of verses.

Result in view.php:
Poem is a textual genre divided into stanzas and verses
each stanza consists of verses.

<p align="justify"><?php echo $poema; ?></p>

1 answer

0

**$array** = explode(',' ,$poema ) That’s the logic you must follow.

Study about the function explode() It certainly solves your problem, only need to then create a foreach or some loop to print each position of the $array[0].

Explaining in a basic way the explode receives 2 parameters:

explode([o separador], [string a ser Destrinchada] )

Well from the logic of really exploding, but as if using the separator to show where.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.