Jump to content

Archived

This topic is now archived and is closed to further replies.

Gooner

returning pound sign from mysql databse

Recommended Posts

Hi

I have a field in a MySQL database that reads:  "abcde:1 bag - £" (without the quotes)

I am returning this value (which is stored as text in the database) as follows:

I split the result into an array, using the : as the delimiter.

So, $array[0] = "abcde" and $array[1] = "1 bag - £"

The problem I have is that when I echo the $array[1] value i get the following displayed:

1 Bag - £

Where does this  come from, and how can I not display it?

Thanks for your help.

Share this post


Link to post
Share on other sites
What collation are you using on this field?  This could be causing the  to display.

You can try changing the collation on this field and see if that removes the character.

Another way to remove it would be to use str_replace to remove it like so:

[code]echo str_replace('Â', '', $array[1])[/code]

Share this post


Link to post
Share on other sites
I does sound like a character set issue...

Share this post


Link to post
Share on other sites
The page is using "charset=iso-8859-1".

The str_replace does solve the problem (although I can't actually type the Â, I have to copy & paste it).

The field is set to "text" in the database.

Any other suggestions, as I'd rather not use the str_replace option.

Thanks

Share this post


Link to post
Share on other sites
I wonder is it's some word processing wizardry involving something "smart" or an en-dash, etc.

Share this post


Link to post
Share on other sites
Yeah, MS Word does that all the time to "smart quotes" -- drives me nuts.

Share this post


Link to post
Share on other sites
Thanks for your replies.

I ahve checked the charset on the table using phpMyAdmin and it states it's using English - iso-8859-1.

I'm not sure what you mean about the word processing issues. This database has never been near one and none of the values come from word (they were actually manually entered into the database).

Share this post


Link to post
Share on other sites
Aha... sussed it thanks.

Navicat, a program I use to edit the database, DIDN'T have the right charset.  I have now put it right and everything is fine.

Thanks for your help.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.