Jump to content

returning pound sign from mysql databse


Gooner

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.
Link to comment
https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/
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]
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
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).

Archived

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

×
×
  • Create New...

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.