Page 1 of 1

presenting data from sql database

Posted: Mon Jun 30, 2003 1:42 pm
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

Posted: Mon Jun 30, 2003 1:48 pm
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

Posted: Mon Jun 30, 2003 2:10 pm
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

Posted: Mon Jun 30, 2003 2:22 pm
by JPlush76

Code: Select all

<?php

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


<? echo nl2br($cd_desc); ?>



?>

Posted: Mon Jun 30, 2003 2:32 pm
by sauron98
Thanks so much it worked a treat!

owe you one!
Dan

Posted: Mon Jun 30, 2003 2:34 pm
by JPlush76
no prob Dan ;)