By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,409 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,409 IT Pros & Developers. It's quick & easy.

htmlentities / html_entity_decode

P: n/a
Hi,

I've been having problems encoding / decoding data, and can't seem to
figure out where I am going wrong.

I extract data from a mysql table with a line like:

$object_name[$a] = stripslashes(htmlspecialchars($row['object_name'],
ENT_QUOTES));
so an entry called, say, '"Y" axis' becomes '"Y" axis'

OK so far...but when I use the line below to decode:

echo html_entity_decode($object_name[$z], ENT_QUOTES);

it stills reads it out as : '"Y" axis'
What point am I missing here ?
Thanks
SS.

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The html_entity_decode function is a newer function. Try this if you
are using an older version of PHP:

// For users prior to PHP 4.3.0 you may do this:
function unhtmlentities($string)
{
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.