RE: formatted text, php and mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



great, works like a dream!

many thanks

Dan

-----Original Message-----
From: 1LT John W. Holmes [mailto:holmes072000@charter.net]
Sent: 19 November 2002 17:12
To: Griffiths, Daniel; php-db@lists.php.net
Subject: Re:  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" <DANIEL.GRIFFITHS@conconf.org>
To: <php-db@lists.php.net>
Sent: Tuesday, November 19, 2002 11:50 AM
Subject:  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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux