html_entities help needed please

In the following snippet I’m transferring MySQL info into an array.

$product_details = array();
$q =
“SELECT *
FROM pp_products
ORDER BY product_id ASC”;
$r = mysql_query( $q );
while( $d = mysql_fetch_object( $r ) ) {
$product_details[ $d->product_id ] = (object) array(
‘product_id’ => $d->product_id,
‘product_name’ => $d->product name,
‘product_price’ => $d->product_price
);
}

However this is displaying a ‘?’ instead of the desired ‘£’ sign.

I think the right syntax would be html_entities( $str, ENT_QUOTES ) but in terms of implementing it, I’m struggling. Would someone please help me out?

Many thanks

Got it sussed

‘product_name’ => mb_convert_encoding( $d->product_name, ‘HTML-ENTITIES’ ),

Sponsor our Newsletter | Privacy Policy | Terms of Service