1

I am making a database on bootstrap code. I have made a database named bootstrap and I have a table named classes. There is a column in that table is named sample and the datatype is tinytext.

When I try to store:

<li class="active"><a href="Jumbotron.html">Profile</a></li>

Then display it with:

<td><?php $str = $row['exsample']; echo wordwrap($str,25,"<br>\n")?></td>

What is displayed is:

href="Jumbotron.html">Profile

I am sure it is because of the < and " in the string.

What datatype should I use so the the whole string is displayed?

AbraCadaver
  • 78,200
  • 7
  • 66
  • 87

1 Answers1

1

You can't wordwrap() HTML and put a <br> in there because it's impossible to tell where that will happen. Your code yields this (view the source of the browser output):

<td><li class="active"><a<br>
href="Jumbotron.html">Profile</a></li></td>

Because it is inserting a <br> right after the <a breaking the HTML.

You might want to look at How do you parse and process HTML/XML in PHP? or one of the Related links, then parse out the text from the HTML and wordwrap() the text.

Community
  • 1
  • 1
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87