Forum Moderators: coopster

Message Too Old, No Replies

Parsing text from mysql

         

ricardopeixoto

4:31 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



Hi there everyone,

Here is my problem,

I have some text (came from a form) on a row on a mysql db. I can access it through dreamweaver (not much of a coder, i know :)), but it displays like the example below:

nome=Ricardo¦¦ morada=R. Tenente Valadim 119¦¦ codigopostal=4750¦¦ codigopostal2=000¦¦ localidade=Barcelos¦¦

Now, i would like to display it in a more orderly fashion, kinda like this:

Nome: Ricardo
Morada: R. Tenete Valadim 119
etc.

I've been trying to assign the info after the = to a variable so i can use it in the html layout, but with no success.

Can anyone help or point me to some guide that can?

Many thanks in advance to all.

Best regards,
Ricardo Peixoto

eelixduppy

8:24 pm on Mar 27, 2008 (gmt 0)



How are you showing the data above? Is that whole string in one column or in multiple columns? If the latter, you should be able to explode [php.net] the string to extract the data that you need to format it. Something like the following:

$arr = explode('=', $string_from_db);
echo 'Name: '.$arr[1];
#etc...