to wordwrap, nl2br or format on the db end
Posted: Tue Aug 29, 2006 11:23 am
Greets,
I've slowly moved to formatting all/most of the formatting work on the db end. So instead of date() I use to_char() which is postgresql function btw, and just echo the output.
For dates and few other things works peachy. However I do have a dillema at the moment.
I need to output some text and I want to output it in same format as it was typed in. I usualy use nl2br or wordwrap to accomplish this, however I'd love to do this on db end and not have to worry about formatting the output by php. Reason for this is because I believe that db will handle this much faster. Only drawback I see to using this method is if I access data from the view for purpose of generating the pdf report or something along those lines where I'd need to strip back the break tags.
I guess, my question pertains to pros and cons of my approach.
"... fool me once ..... uhmmm ..."
~w
I've slowly moved to formatting all/most of the formatting work on the db end. So instead of date() I use to_char() which is postgresql function btw, and just echo the output.
For dates and few other things works peachy. However I do have a dillema at the moment.
I need to output some text and I want to output it in same format as it was typed in. I usualy use nl2br or wordwrap to accomplish this, however I'd love to do this on db end and not have to worry about formatting the output by php. Reason for this is because I believe that db will handle this much faster. Only drawback I see to using this method is if I access data from the view for purpose of generating the pdf report or something along those lines where I'd need to strip back the break tags.
I guess, my question pertains to pros and cons of my approach.
"... fool me once ..... uhmmm ..."
~w