Jump to content

html_entity_decode() Help.


grozanc

Recommended Posts

Hello Everyone,

 

I have a pdf that is automatically generated, unfortunately it's pulling ascii codes from the database and displaying them as ascii. I want to use the

html_entity_decode()

command to make the ascii display as the actual symbol (in my case a trade mark symbol instead of ™).

 

Here is the line of code the outputs the information from the database

$prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];

 

My question is where would I wrap the

html_entity_decode()

around to change

products[$i]['name'] 

from ascii to text?

 

Thanks,

Gary

Link to comment
https://forums.phpfreaks.com/topic/266574-html_entity_decode-help/
Share on other sites

OK, I've tried the following and nothing seems to work. Can anyone spot what I'm doing wrong. I'm a newb when it comes to PHP so I don't expect that I'm doing this right. Please let me know if I'm not giving you enough information to be able to help.

 

$prod_str = $order->products[$i]['qty'] . " x " . $order->html_entity_decode(products[$i]['name']);

Page Load Error

$prod_str = $order->products[$i]['qty'] . " x " . html_entity_decode($order->products[$i]['name']);

Page renders but ascii character aren't converted.

html_entity_decode($prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name']); 

Page renders but ascii character aren't converted.

$prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name'];
$prod_str = html_entity_decode($prod_str); 

Page renders but ascii character aren't converted.

Hmm... Could you post an example of the content with the erroneous data, as well as the result of the following snippet?

var_dump ($order->products[$i]); die ();

 

Just add it directly above or after the snippet you have posted in your previous post, and use "show (page) source" to fetch the raw output for us.

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.