RE: [PHP-DB] Convert plain text to HTML tagged text

From: Date: Tue, 28 Sep 2004 17:52:54 +0000
Subject: RE: [PHP-DB] Convert plain text to HTML tagged text
Groups: php.db 
Request: Send a blank email to php-db+get-36441@lists.php.net to get a copy of this message
On 28 September 2004 18:15, veditio@comcast.net wrote: > To the list: > > I've googled and searched the manual, but I'm still looking > for a simple solution to a simple problem. > > I have a MySQL database of text stories in longtext MySQL > fields. These stories have simple returns (\r) in them and no > other formatting. I need to use these stories both for web > and print production, so I need to be able to get the text > out of MySQL via PHP and have those returns change to <P> > tags. But I also need to keep those extra <P> tags out of the > database file so the text can be exported and poured into a > layout program. > > HTMLspecialchars and HTMLentities don't seem like the right > solution, but maybe I'm missing something. Do I have to use > regular expressions in PHP as the text is pulled from the database? http://www.php.net/str_replace should be all you need -- no need for regexps for such a simple replace. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.db (#36441) next »