On Friday, December 19, 2003, at 12:19 PM, Philip J. Newman wrote:

Hi, is the best way to store data in a mysql database in the text it was submitted, or in HTML
format ... changing all the \r's and things to <br>

There's definitely no best way...


Theory 1:
Store it in the format you'll most commonly use it in, eg HTML for mostly HTML work, or raw text for mostly raw-text work (eg email, text files, etc). Make sure you can transform it back though!


Theory 2:
Always keep the original input, and do basic conversions to HTML on the way out. nl2br() isn't going to add much overhead at all to standard text on anything but the largest, most busy websites. If you change your mind on HOW you wish to transform the text at a later date, it's much easier to change it in the output script, rather than the input script AND all existing blocks of text.


Theory 3:
For more complex transformations (I have a library which performs heaps of transformations for paragraphs, headings, line breaks, ol and ul lists, and heaps more), it makes sense to me that you'd store the transformed version (to save on repetitive, processor-intensive tasks), and perhaps the original as well (to save converting back when needed in plain text).



Cheers, Justin French

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



Reply via email to