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
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.