Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 117,165 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 2,546 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Display address (as it is in database)

 
Reply to this topicStart new topic

Display address (as it is in database)

dadaso
post 27 Jun, 2008 - 03:53 AM
Post #1


New D.I.C Head

*
Joined: 9 Jun, 2008
Posts: 23


My Contributions


Example
In database like address field like containing the data like
Dadaso Chavan
A/p-Indapur
Dist-Pune
mh,India

I want to display as

Dadaso Chavan
A/p-Indapur
Dist-Pune
mh,India
but it display like

Dadaso Chavan A/p-Indapur Dist-Pune mh,India

is it any solution?


User is offlineProfile CardPM

Go to the top of the page


joeyadms
post 27 Jun, 2008 - 04:09 AM
Post #2


D.I.C Head

Group Icon
Joined: 4 May, 2008
Posts: 145



Thanked 6 times

Dream Kudos: 600
My Contributions


Try nl2br() , if that does not do it, then try storing the data in the database with \n for the newline and use nl2br() .

Or you could use regex to match it, assuming every row is formatted alike.

Regex, and any other kind of format recognization is really unpredictable, especially if the data you are storing is variable.

What I would do, is to modify my tables to include the newline delimeter, and setup my application to store newline delimters when adding new records. It is a little bit of work in front, but a quick run through nl2br and your output is formatted exactly how you want and is consistent.

User is offlineProfile CardPM

Go to the top of the page

dadaso
post 27 Jun, 2008 - 04:26 AM
Post #3


New D.I.C Head

*
Joined: 9 Jun, 2008
Posts: 23


My Contributions


QUOTE(joeyadms @ 27 Jun, 2008 - 04:09 AM) *

Try nl2br() , if that does not do it, then try storing the data in the database with \n for the newline and use nl2br() .

Or you could use regex to match it, assuming every row is formatted alike.

Regex, and any other kind of format recognization is really unpredictable, especially if the data you are storing is variable.

What I would do, is to modify my tables to include the newline delimeter, and setup my application to store newline delimters when adding new records. It is a little bit of work in front, but a quick run through nl2br and your output is formatted exactly how you want and is consistent.


nl2br() or <br> inserting data solves the problem but data contain paragraph,spaces then it not working
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/6/08 11:22AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month