great, works like a dream!

many thanks

Dan

-----Original Message-----
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: 19 November 2002 17:12
To: Griffiths, Daniel; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] formatted text, php and mysql


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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to