-1

I am saving html data into mysql

like below

<p>&lt;div id=&quot;aaa&quot;&gt;asdadad&lt;/div&gt;</p>
<p>&lt;div id=&quot;aaa&quot;&gt;asdadad&lt;/div&gt;</p>
<div class="something">some data</div>

when showing the html as string in front end using php , it coverts all 3 lines(above) to html content not just string

But I expect the below result

first 2 line as string and 3rd line as html

I used:

html_entity_decode($content_from_db, ENT_QUOTES, 'utf-8');
2
  • Are you saying that PHP randomly added <p> tags to your string, for no reason? Commented Jan 7, 2013 at 1:49
  • possible duplicate see here Commented Jan 7, 2013 at 1:50

1 Answer 1

0

Don't do anything to the data, just print it straight to the browser. If the data is stored as you say then you will get expected behaviour. If you don't get expected behaviour then either:

  • Data is not stored correctly, view it in MySQL console or a RDBMS
  • You are post-processing data after it is being pulled from DB
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.