joinx Posted May 7, 2008 Share Posted May 7, 2008 How to format data from a database.. I have a list of description that i retrieve form database..this is coming as a paragraph and me i want each sentence on one line... How should i do?? Quote Link to comment https://forums.phpfreaks.com/topic/104588-format-data/ Share on other sites More sharing options...
moselkady Posted May 7, 2008 Share Posted May 7, 2008 If what you want is to split a paragraph into a sentence and print each on in a separate line, you can try this example: <?php $paragraph = "Line 1. This is line 2. Line number 3"; echo ereg_replace("\. *", ".\n", $paragraph); ?> Quote Link to comment https://forums.phpfreaks.com/topic/104588-format-data/#findComment-535336 Share on other sites More sharing options...
blackcell Posted May 7, 2008 Share Posted May 7, 2008 Try looking over http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html if your wanting to do it with mysql and dates. If not you can always format when you bring it out of the database like moselkady did. Quote Link to comment https://forums.phpfreaks.com/topic/104588-format-data/#findComment-535337 Share on other sites More sharing options...
joinx Posted May 7, 2008 Author Share Posted May 7, 2008 ok i solved my problem..in the database i insert <br>after each line.. thnxxxxxxxxx Quote Link to comment https://forums.phpfreaks.com/topic/104588-format-data/#findComment-535374 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.