Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.