presenting data from sql database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sauron98
Forum Newbie
Posts: 16
Joined: Mon Jun 30, 2003 1:42 pm

presenting data from sql database

Post by sauron98 »

Dear Everyone

Im sorry for this real newbie question. Im working on a project at http://www.hiphopmusicsource.co.uk/hiphopmu/view_cd.php

Im entering CD track listings into sql database.

When I retrieve the results in the web browser there is no way for me to tabulate the listing. I dont know how to word wrap it or make it understand the original line breaks when i typed it in..its just 2 lines..

can anyone please help me...
kindest regards
Dan
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

have you tried nl2br($field)

new line - break

basically when you hit the ENTER key and you go to the next line it creates a NEWLINE character and when the browser reads it if you have your field with that function it will turn those newlines into <BR> tags

hope thats what you needed
sauron98
Forum Newbie
Posts: 16
Joined: Mon Jun 30, 2003 1:42 pm

Post by sauron98 »

Hi there

Thanks very much for the help...ive been trying to use that but without success.

What page should this tag be on? The page with the htm form that originally submits the data/listing. Or the the page that finally presents the data?

Ive been trying to add it to the former. The actual data submission form...
<textarea name="cd_desc"><?echo $cd_desc;?></textarea>

do yuo think this is the correct place?
thanks so much for the help
Dan
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

Code: Select all

<?php

//you wanna add it to the page that you're presenting the data on 


<? echo nl2br($cd_desc); ?>



?>
sauron98
Forum Newbie
Posts: 16
Joined: Mon Jun 30, 2003 1:42 pm

Post by sauron98 »

Thanks so much it worked a treat!

owe you one!
Dan
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

no prob Dan ;)
Post Reply