This may belong in another Topic, but ...
Is there a simple function that will allow me to save text input by the user in a form as HTML in my SQL database to preserve the paragraph breaks? I can't seem to find a simple function, will I need a PEAR lib or something?
Thanks in advance!!
saving HTML to a database field
Moderator: General Moderators
Not quite what I need
Hmm.. actually strip-tags() is the exact opposite of what I need.
Ok, when I enter text into a field like the "post a reply" as I am doing now, the backend of this website preserves all of the line breaks between paragraphs.
The spaces between paragraphs will be remembered, stored away in the database. Then the site SELECT's back the data to display it and all of the line breaks are there, just as they should be.
My app, however, stores all of the line breaks to the database but a SELECT function to the database returns only a long sequence of text no matter how many breaks I put in it.
I dont care if my database looks clunky or ful of tags, I just want to be able to call back the line breaks without manually adding br tags.
Am I simply doing something wrong?
Ok, when I enter text into a field like the "post a reply" as I am doing now, the backend of this website preserves all of the line breaks between paragraphs.
The spaces between paragraphs will be remembered, stored away in the database. Then the site SELECT's back the data to display it and all of the line breaks are there, just as they should be.
My app, however, stores all of the line breaks to the database but a SELECT function to the database returns only a long sequence of text no matter how many breaks I put in it.
I dont care if my database looks clunky or ful of tags, I just want to be able to call back the line breaks without manually adding br tags.
Am I simply doing something wrong?
If you're using MySQL, you can substitute the \n escape character for newlines. When you read the record back out from the database, the \n will appear as a new line (ie. you won't have \n's all through the data when you read it back out).
Reference links:
MySQL Strings info: http://dev.mysql.com/doc/mysql/en/String_syntax.html
Reference links:
MySQL Strings info: http://dev.mysql.com/doc/mysql/en/String_syntax.html