23 янв. 2012 г.

Replace newline with <br/> in DB

To replace \n with html <br/> in DB (e.g. add WYSIWYG such as tinyMCE to web site that is already in production)

update tbl_name set tbl_field = REPLACE(tbl_field, '\n\r', '<br/>');
update tbl_name set tbl_field = REPLACE(tbl_field, '\n', '<br/>');
update tbl_name set tbl_field = REPLACE(tbl_field, '\r', '<br/>');

Комментариев нет:

Отправить комментарий