WebRef.eu  - Internet Marketing and Online Business Resources  

Home / Site Map | Blog | TwitterTwitter | Contact

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:


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:



Low Prices UK Shopping

Compare Prices
at LowPrices.co.uk

Home / Site Map | TwitterTwitter | Contact

All Content ©2018 WebRef.eu