galvin Posted June 7, 2009 Share Posted June 7, 2009 I have a MySQL database with an "item" column and in there is an item for "Sweet Child o' Mine" (because when I submitted it to the database, I entered it into my form as just "Sweet Child o' Mine" and then ran htmlentities on it before placing it in the database). Now I have some code that pulls all the "items" from the database and it pulls it back as "Sweet Child o' Mine" which is causing problems with other code throughout my website that uses this item, but is expecting it to be just "Sweet Child o' Mine". NOTE: I have plenty of other "items" that do NOT have apostrophes and they are working just fine. Below is the basic code where, after I queried the items from the MySQL database, I tried to use html_entity_decode to turn it back to just "Sweet Child o' Mine" but it's not doing it. It still has it showing as "Sweet Child o' Mine" when I echo the $output variable. Any ideas what I'm doing wrong? while ($row = mysql_fetch_assoc($result)) { $output .= '"' . html_entity_decode($row['item']) . '",'; } Link to comment https://forums.phpfreaks.com/topic/161287-solved-htmlentitiesapostrophe-trouble/ Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 For html_entity_decode, pass it the optional second parameter - ENT_QUOTES. Link to comment https://forums.phpfreaks.com/topic/161287-solved-htmlentitiesapostrophe-trouble/#findComment-851103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.