3

I fetch description from database(MySql). I store the description in html format. When i display description with char limit it cut some tag so the formation is change. So any idea how can i fix this problem.

In database description is store like:

<b>Hello</b><br/><p>This is my HTML code</p>

When I use string limit while displaying this description like limit=8 character then the Hello will come in bold but after hello world the all other content will come in bold.

Limit is 8 so it counts from database till <b>Hello. This </b> will not be count so the <b> tag not over and the other content will come in bold.

David Coder
  • 1,138
  • 2
  • 14
  • 48
  • can you post an example? – sinhayash Jun 29 '15 at 05:52
  • 2
    Have a look at this question: http://stackoverflow.com/questions/3810230/close-open-html-tags-in-a-string You can apply the function explained in the solution to close all tags of your string. So you just have to make sure you won't cut your string within a tag. – André Jun 29 '15 at 06:15
  • Thanks Andre it works.... – David Coder Jun 29 '15 at 06:34

0 Answers0