WebRef.eu  - Internet Marketing and Online Business Resources

Home | Contact Us

Google
 

How to Display Linebreaks from a MySQL Database with PHP

After doing your MySQL query, you might have code such as the following to display the data on your web page:

<?=$list['ReviewDesc']?>

However, with the above code, any line breaks that your data contains will not be rendered on the page. You'll be able to see the linebreak symbols when looking at the data in MySQL Query Browser, but then no linebreaks are rendered when your data is displayed in the browser.

The answer is to use the nl2br function, literally the newline to linebreak function. This converts any linebreak symbol in your MySQL database to <br /> in the browser:

<?=nl2br($list['ReviewDesc'])?>

 



Join Top Affiliate Networks Join Top Affiliate Networks >>>



Paid On Results








Home | Contact Us

All Content ©2006 WebRef.eu