PHP and MYSQL - spaces in text
Page 1 of 1
MamaKin




Posts: 31

PostPosted: Tue, 14th Feb 2006 01:49    Post subject: PHP and MYSQL - spaces in text
I realise that newlines can be kept when retrieving from a database by using str_replace(); but can the same be done for more than one space either side of some text.

The problem seems to be that even if there is more than one space between/before/after some text only one space is printed. Is there any way that the spaces can be kept?

Thanks in dvanced,
Craig
Back to top
fobu




Posts: 6

PostPosted: Thu, 9th Mar 2006 16:28    Post subject:
I assume you are using HTML as output.
A HTML-page only displays one space no matter how many spaces are in your text, because otherwise every would be a mess.

something like str_replace(' ',' '); should do the trick.
But you should also check out the following php functions:
htmlspecialchars();
nl2br();
Back to top
MamaKin




Posts: 31

PostPosted: Sun, 12th Mar 2006 20:05    Post subject:
Thanks matey Wink
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group