formatted text, php and mysql
| From: | Griffiths, Daniel | Date: | Tue, 19 Nov 2002 16:50:06 +0000 |
| Subject: | formatted text, php and mysql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-23479@lists.php.net to get a copy of this message | ||
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