Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
£ being displayed as �
Old 10-09-2007, 07:46 AM £ being displayed as �
Experienced Talker

Posts: 39
Trades: 0
Hello

I have the following text in my mySQL database...

"Prices from: £1350.00 + VAT"

I use the following code to insert it into my web page...

"<?php echo $row_rsProdList['desc_pro']; ?>"

But the following is displayed online ...
"Prices from: �1350.00 + VAT"

Can anyone let me know where my problem is?

Cheers

Paul
69me is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-09-2007, 07:53 AM Re: £ being displayed as �
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Because £ must be trasformed to the HTML entitie &pound;
You'll have to use str_replace() or htmlentities() on every strings coming from your db that could contain this character.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 10-09-2007, 07:56 AM Re: £ being displayed as �
Experienced Talker

Posts: 39
Trades: 0
Tripy

Many thanks, problem now solved!!!

Cheers

Paul
69me is offline
Reply With Quote
View Public Profile
 
Old 10-09-2007, 08:07 AM Re: £ being displayed as �
Experienced Talker

Posts: 39
Trades: 0
Opps another small problem I also want to incorporate nl2br funcation...

Currently I have...
"<?php echo htmlentities($row_rsProdList['desc_pro']); ?>"

But also want the following built in...
"<?php echo nl2br($row_rsProdList['desc_pro']); ?>"

Any ideas Tripy?

Cheers

Paul
69me is offline
Reply With Quote
View Public Profile
 
Old 10-09-2007, 08:19 AM Re: £ being displayed as �
Experienced Talker

Posts: 39
Trades: 0
Okay problem solved again...

"<?php $temp = htmlentities($row_rsProdList['desc_pro']);
echo nl2br($temp) ?>"

..well thats my way of doing it, is there a better / more simple way?
69me is offline
Reply With Quote
View Public Profile
 
Old 10-09-2007, 08:58 AM Re: £ being displayed as �
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0

No, I would almost have done it that way too. Just chained the functions calls:
PHP Code:
"<?php echo nl2br(htmlentities($row_rsProdList['desc_pro']));?>"
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to £ being displayed as �
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44682 seconds with 12 queries