Gooner Posted September 25, 2006 Share Posted September 25, 2006 HiI 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 More sharing options...
aliendisaster Posted September 25, 2006 Share Posted September 25, 2006 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] Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-98305 Share on other sites More sharing options...
fenway Posted September 25, 2006 Share Posted September 25, 2006 I does sound like a character set issue... Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-98404 Share on other sites More sharing options...
Gooner Posted September 26, 2006 Author Share Posted September 26, 2006 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 Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-98764 Share on other sites More sharing options...
fenway Posted September 26, 2006 Share Posted September 26, 2006 Not the page, the table. Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-99110 Share on other sites More sharing options...
AndyB Posted September 26, 2006 Share Posted September 26, 2006 I wonder is it's some word processing wizardry involving something "smart" or an en-dash, etc. Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-99132 Share on other sites More sharing options...
fenway Posted September 26, 2006 Share Posted September 26, 2006 Yeah, MS Word does that all the time to "smart quotes" -- drives me nuts. Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-99157 Share on other sites More sharing options...
Gooner Posted September 27, 2006 Author Share Posted September 27, 2006 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). Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-99595 Share on other sites More sharing options...
Gooner Posted September 27, 2006 Author Share Posted September 27, 2006 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. Link to comment https://forums.phpfreaks.com/topic/21980-returning-pound-sign-from-mysql-databse/#findComment-99600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.