Re: formatted text, php and mysql
| From: | 1LT John W. Holmes | Date: | Tue, 19 Nov 2002 17:12:23 +0000 |
| Subject: | Re: formatted text, php and mysql | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23482@lists.php.net to get a copy of this message | ||
Have you looked at the nl2br() function?
echo "<tr><td>" . nl2br($content) . "</td></tr>";
That may give you the output you're looking for.
---John Holmes...
----- Original Message -----
From: "Griffiths, Daniel" <DANIEL.GRIFFITHS@conconf.org>
To: <php-db@lists.php.net>
Sent: Tuesday, November 19, 2002 11:50 AM
Subject: [PHP-DB] formatted text, php and mysql
Hi, hopefully someone can help me out with this..
I need to be able to copy text from a document, keeping carriage returns and
white space chars, into a database and output the same to a web page.
I have a field in a mysql table of type 'longtext' into which i can load
text and keep the white space and carriage return characters intact.
I can output this field to a page using php in a similarly formatted way by
using the <pre> tag in an echo statemnet : -
echo "<tr><pre>$content</pre></tr>";
however, by using the <pre> tag all individual lines of text are printed on
a single line and the sizing of my table is ignored, i.e. the text won't
wrap. <pre width=20> for example doesn't work.
Is there a 'proper' way of doing something like this with php without
relying on printing out html tags with the string?
cheers
Dan
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php