Jump to content

need help formatting php mysql output


BobH

Recommended Posts

I have a mysql database that has your typical data in it, ie. name address, etc.  The problem I am having is with the address.  The address is setup as a varchar with 200 as the length and the data is street, city, st, zip on 1 line.  I need to format the output with street on 1 line and city, st, zip on another.  I cannot change input format because of the way the program uses the address string to fetch the lat and lng before it writes it to the database.  Is there a way to add a line break or <br> to the address before it is written or change it after it is written using sql or php script or possible as I format the output?  The street, city, st, zip are separated by commas in the record.

 

Thanks in advance for all the reply's  :D

Link to comment
Share on other sites

Thanks for the quick reply and example.  I did some research on the explode() and I believe I can use it to either format the output or better yet create a new string before it is written to the database and get the desire out come.  As you can see I am still learning.  ;)

 

Thanks  :D

Link to comment
Share on other sites

Thanks for the quick reply and example.  I did some research on the explode() and I believe I can use it to either format the output or better yet create a new string before it is written to the database and get the desire out come.  As you can see I am still learning.  ;)

 

Thanks  :D

 

Did you even try the sample code I provided? It used explode() as well as list() to populate the individual values into discrete variables. You can then output in any manner you wish such as the example I provided.

Link to comment
Share on other sites

Thanks for the quick reply and example.  I did some research on the explode() and I believe I can use it to either format the output or better yet create a new string before it is written to the database and get the desire out come.  As you can see I am still learning.  ;)

 

Thanks  :D

 

Did you even try the sample code I provided? It used explode() as well as list() to populate the individual values into discrete variables. You can then output in any manner you wish such as the example I provided.

 

Yes I will use it but am at work now.  A big thanks.  I meant after your mentioned explode(), I did a little research as to how it worked.  Looks like your example will work just fine..tks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.