Board index   FAQ   Search  
Register  Login
Board index php forum :: Database phpMyAdmin

quick question

How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues

Moderators: macek, egami, gesf

quick question

Postby icravecheese » Thu Aug 05, 2004 2:24 am

im trying to find out how to take the text formatting(ie paragraphs) from my database, It seems to come up fine in phpmyadmin, but im strugling getting it onto my page that way, it just comes up as one long line, which then wraps around depending on how ive set up the tables in html.
I couldn't a way of describing what im looking for in a few words so hopefully my ramblings make sense to some bright spark with the answer. Thanks
icravecheese
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Aug 05, 2004 2:09 am

str_replace() and nl2br()

Postby gesf » Thu Aug 05, 2004 3:46 am

You´re looking for php's str_replace() and/or nl2br() functions ;)
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby icravecheese » Thu Aug 05, 2004 4:20 am

Right, thats a help, but Im more interested in finding out how phpmyadmin stores the data itself, it clearly has some sort of formatting, but unfortunetly I can't see what it is at any point. Does the /n disapear when outing in html? if so, how come?
icravecheese
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Aug 05, 2004 2:09 am

Postby swirlee » Thu Aug 05, 2004 5:40 am

phpMyAdmin does not do any formatting to your records.

The trouble is that you have newlines ("\n") in your text, and you're expecting them to display in your browser as newlines. Browsers don't do that -- you have to use HTML to format your text. If you do View > Source in the browser, you'll see that the newlines are there, they just aren't displayed (because they're not supposed to be). That's where nl2br() comes in. It converts newlines to HTML line breaks so they'll be displayed.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back


Return to phpMyAdmin

Who is online

Users browsing this forum: TurnitinBot [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron