Arranging Data From Database

A

Anonymous

Guest
Hi, I've some data in my database like this
Code:
1. Barbie Girl 2. Beat It 3. Careless Whisper 4. Earth Song
5. I'll Remember 6. November Rain 7. Smooth Criminal

I want to change it to
Code:
1. Barbie Girl 
2. Beat It 
3. Careless Whisper 
4. Earth Song
5. I'll Remember 
6. November Rain 
7. Smooth Criminal

Please tell me how can I view in php page
 
Hi, I've inserted some data to my database from a html page(textarea field) into text attribute column of my database. When I want to view that column i got the output like this ...
Code:
1. Barbie Girl 2. Beat It 3. Careless Whisper 4. Earth Song
5. I'll Remember 6. November Rain 7. Smooth Criminal

But I want to view those data like this
Code:
1. Barbie Girl 
2. Beat It 
3. Careless Whisper 
4. Earth Song
5. I'll Remember 
6. November Rain 
7. Smooth Criminal

How can i do that. These r the output that will be shown to a php page(retrieve from database then view to php page).
 
patna_in said:
Hi, I've inserted some data to my database from a html page(textarea field) into text attribute column of my database. When I want to view that column i got the output like this ...
Code:
1. Barbie Girl 2. Beat It 3. Careless Whisper 4. Earth Song
5. I'll Remember 6. November Rain 7. Smooth Criminal

But I want to view those data like this
Code:
1. Barbie Girl 
2. Beat It 
3. Careless Whisper 
4. Earth Song
5. I'll Remember 
6. November Rain 
7. Smooth Criminal

How can i do that. These r the output that will be shown to a php page(retrieve from database then view to php page).
I see only 2 ways to solve this:
I. use a explode function, but after what to you need use arrays and e.t.c
II. If you got this only once better divide by hand and set block for maximum chars into field.

P.S. Alexey ask nex how data storing in DB how you get data from DB and how you do to output... It's standard simple questions
 
But as far as i can see: when you entered the data:

you had new lines, in the textarea it looked like this:

1. Foo
2. Bar
3. Whatever

But when you try to make an output: it comes on one row.
Solution: nl2br() on the field data. it will convert all \n to <br />

WiZARD: Konshaj naezat... ego vopros mozno rascenit poraznomu..
 
Back
Top