hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Line Spacing with MySQL Information
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Line Spacing with MySQL Information

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 08-29-2002, 06:21 AM
Ebart Ebart is offline
Newbie
 
Join Date: May 2002
Location: Adelaide, Australia
Posts: 11

Line Spacing with MySQL Information


When i insert a multi line variable into mysql i.e

"Title: New
Band: After
Shop: Pro

...... Information Here"

I dont wanna have to put <br> in for each time i want it to add a line space in.

When i display the mysql information inside a form textarea it works fine, but if i display it in a regular table it wont include the spaces and it would turn out like this..

"Title: New Band: After Shop: Pro ...... Information Here"

What functions do i need to put in when adding and querying from the database. Ive tried trim(), addslashes() and stripslashes() which had no effect.

__________________
http://www.ebart.net
AIM: ebartaim
ICQ: 154906526
MSN: mike@ebart.net

Reply With Quote


Sponsored Links
  #2  
Old 08-29-2002, 06:28 AM
shaunewing shaunewing is offline
Premium Member
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 1,744
What about using 'nl2br'?

Basically this function converts all newlines to <br>

For more information including usage you can look at http://www.php.net/manual/en/function.nl2br.php

Hope that's what you were after!

--Shaun

__________________
Shaun Ewing
http://shaun.net

Reply With Quote
  #3  
Old 08-29-2002, 06:39 AM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994
Quote:
Originally posted by shaunewing
What about using 'nl2br'?

Basically this function converts all newlines to <br>

--Shaun
Of course new versions converts newlines to <br />

Reply With Quote
Sponsored Links
  #4  
Old 08-29-2002, 06:46 AM
shaunewing shaunewing is offline
Premium Member
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 1,744
Quote:
Originally posted by Rich2k


Of course new versions converts newlines to <br />
Yes, of course - I actually just noticed that when looking at the page

--Shaun (who is proud to announce that his new personal site is XHTML 1.0 compliant according to the W3C validator ).

__________________
Shaun Ewing
http://shaun.net

Reply With Quote
  #5  
Old 08-29-2002, 08:20 AM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994
Quote:
Originally posted by shaunewing

-- who is proud to announce that his new personal site is XHTML 1.0 compliant according to the W3C validator.
Wow someone with XHTML 1.0 compliance... now that's rare!

Have you read about XHTML 2.0... basically will break all existing sites coded in XHTML 1.0 and below!

http://news.com.com/2100-1023-949492.html

Quote:
Of primary concern to some Web developers is the W3C's warning that XHTML 2.0 will not be "backward compatible" with HTML 4.0 and XHTML 1.0. That alert has raised concern that billions of existing Web pages risk obsolescence unless they are translated to the new Web language.

Reply With Quote
  #6  
Old 08-29-2002, 09:33 AM
shaunewing shaunewing is offline
Premium Member
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 1,744
Quote:
Originally posted by Rich2k

Wow someone with XHTML 1.0 compliance... now that's rare!
I was surprised, I had to design a personal site for myself (I took it down in January) and thought I'd do it in XHTML as my first XHTML site.

The first run through the validator had 1 error, about a table height tag which I then moved to the CSS. I then ran it through again and voila!

Quote:
Have you read about XHTML 2.0... basically will break all existing sites coded in XHTML 1.0 and below!
Hmm, thanks for the link. Made for an interesting read. Now I wonder if I should start converting my sites over to 1.0/1.1 or wait for 2.0

--Shaun

__________________
Shaun Ewing
http://shaun.net

Reply With Quote
  #7  
Old 08-30-2002, 09:59 AM
jtrovato jtrovato is offline
Aspiring Evangelist
 
Join Date: Aug 2002
Location: Long Island
Posts: 427
When displaying the contents of I am assuming a text field in the MySQL database.

When I print I use something like this and then format the text the way I want witht he <font></font>

<pre><font size=3> <? echo $row->textfield; ?></font> </pre>

That seems to work for me or at least for what I need it to do.

John

__________________
John Trovato
In Office Networks, LLC
Programmer, Cisco Network Engineer, Roofer, Biochemist, and Conductor.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Website usability – 10 tips for getting it right Blog 2012-04-27 14:11:03
Web Host Rackspace Launches Private Beta for MySQL Cloud Database Web Hosting News 2011-12-01 21:09:51
Parallels Now Offering Licenses for CloudLinux OS Web Hosting News 2011-10-26 17:29:25
Web Host FireHost Partners with Cloud Security Firm Gazzang for Data Encryption Web Hosting News 2011-08-16 20:33:43
Cloud Security Firm Dome9 Names David Meizlik VP of Marketing Web Hosting News 2011-06-22 16:47:50


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?