Jump to content

How do I store formatted text into MySQL?


colinexl

Recommended Posts

Hi all, I have a message board that will store user input into a mysql database. The input is much like a forum input like the one i'm typing in now. It's able to store line returns etc. I'm using a LONGTEXT to store the user inputs but when I print it back using PHP, it gives one long time of text. For example if the user typed:

Hi,

This is a test.

Bye.

It would print out:

Hi, This is a test. Bye.

I'm submitting the user input into the database using POST method. If I do a manual "select * from..." in the mysql CLI, I can actually see the line breaks in the result. It's just that when PHP prints it, it leaves out the line breaks. Any help would be grateful! Thank!
Link to comment
https://forums.phpfreaks.com/topic/16395-how-do-i-store-formatted-text-into-mysql/
Share on other sites

I was unfamiliar with that (magic_quotes_runtime) until just now...here's what the manual says about it:

[quote]magic_quotes_runtime  boolean

    If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash. If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash. [/quote]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.