PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 4th, 1999, 06:33 PM
newmediaarts
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I'm working with a mysql/php setup and have run into a major problem (for me atleast). We have mysql TEXT fields that contain line breaks and the kind something like

FIELD CONTENT
-------------
First paragraph

Second paragraph

Third Paragraph
--------------
END FIELD CONTENT

While that is fine in MySQL when it is output to HTML it comes out as

NETSCAPE
---------
First paragraphSecond paragraphThird paragraph
---------
END NETSCAPE

Does anyone know of a php function that can add in the needed <BR> and <P> so that the output will actually look as intended?

------------------
Luke Bowerman
new media arts
www.judebowerman.com/nma


Reply With Quote
  #2  
Old September 5th, 1999, 01:01 AM
newmediaarts
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Never mind... I made my own solution using a build in function & a regular expression.

$var = stripslashes($var);
$var = ereg_replace( "n","<br>",$var);

------------------
Luke Bowerman
new media arts
www.judebowerman.com/nma


Reply With Quote
  #3  
Old September 5th, 1999, 04:18 AM
ExPulse
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
PHP has a built in function nl2br();

http://www.php.net/manual/function.nl2br.php3

It is faster than using regex.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > MySQL to HTML Formatting

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap