Re: Formatting text from a MySQL DB

From: Date: Fri, 29 Sep 2000 07:31:41 +0000
Subject: Re: Formatting text from a MySQL DB
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-18011@lists.php.net to get a copy of this message
On Fri, 29 Sep 2000, Ben Weinberger wrote: > Hi~ > I'm storing text in a MySQL database and then displaying it on a web page > by calling it through PHP. The text needs to be able to be formatted with > HTML code-- i.e. My MySQL entry might look like: > > This is my <B>Text.... I am testing my</b> text to see if <I> it > works</i>. > This is a test... test test test... test... > Testing 1234 1234.... > > I want the bold and italic formatting to carry through to my web page... > and I need to spacing to carry as well. I tried using the "pre" tag in > HTML-- but then the HTML formatting doesn't work. How do I display the > information from my database and keep the spacing and HTML formatting? > > Thanks, > -Ben Well, you might look at converting all spaces to &nbsp; and using nl2br to force lie breaks - and then you'd need to force a fixed width font or the spacing would be all out of kilter. Perhaps you'd be better off presenting this stuff some other way? -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#18011) next »