-
October 18th, 2002, 06:05 AM
#1
Junior Member
mysql question
Need help...
I have stored a formatted text content of three paragraphs long into a field of type TEXT.
When I retrieve the text content from the MySQL database using a PHP script and have it displayed on a HTML, I get a continuous text instead of three paragraphs of text.
Any ideas on how I can display the text properly? Thanks.
-
October 18th, 2002, 06:12 AM
#2
Yup. MySQL doesn't care what a carriage return is. The way I got around that is I used PHP to search for the carriage return character (I think it was '\n', or perhaps '\r\n') and replaced it with a tag. There is probably a cleaner way to do this, but this method worked for me. Good luck, and let me know what you use.
/* You are not expected to understand this. */
-
October 18th, 2002, 03:58 PM
#3
Found the PHP code I used to search for carriage returns in a string and replace them with
or
tag:
PHP Code:
$mystring = preg_replace("/\r\n|\n\r|\n|\r/", " ", $mystring);
Hope that works for you
/* You are not expected to understand this. */
-
October 21st, 2002, 02:16 AM
#4
Junior Member
thanks roswell1329
Thanks for the help, will check it out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|