How do I echo out pre-formatted text from a MySQL database?

How do I echo out pre-formatted text from a MySQL database?
0

#1

Hello :slight_smile:

I am sending some HTML input data to a MySQL database with PHP.

One of those form inputs send the data to MySQL in JSON format.

This (an HTML paragraph with rich formatting):

“this is some text from a wysiwyg editor”

The same thing in the database would be:

"{"ops":[{"attributes":{"underline":true},"insert":"this"},{"insert":" is some "},{"attributes":{"bold":true},"insert":"text"},{"insert":" from a "},{"attributes":{"italic":true},"insert":"wysiwyg"},{"insert":" editor\n"}]}"

I’m having trouble figuring out how display the data like the above formatted string when I select and echo out the data from the database.

Simply put, I’d like to know how FCC right here uses a wysiwyg editor for creating posts and then displays the posts in the same format we used when creating it.

How should I go about doing this?