Jump to content

[SOLVED] HTML Tags in a LongText


basement

Recommended Posts

I have a block of text that occasionally has some text that needs to be bolded or italicized, as well as the occasional table

 

I have the table set up as follows:

ID / Date / Title / Article

 

where article is longtext. in that article i have {b}{/b} once in a while but when i pull the data from the table with

 

$query="SELECT date, title, article FROM News ORDER BY date";

$result=mysql_query($query) or die(mysql_error());

 

$itd = $_GET["id"];

$title = htmlentities(mysql_result($result,$itd,"title"));

$article = htmlentities(mysql_result($result,$itd,"article"));

echo("<h1>" . $title . "</h1><br />");

echo nl2br("<p>" . $article . "</p></div>");

$num--;

mysql_close($connection);

 

 

 

i'm assuming that the nl2br is what is messing it up. possibly. i took it out and just echoed $article but that didn't work either. how can i output what is in article as html code with text instead of just a huge block of text? I hope this hasn't been asked too often. I can't find an answer anywhere. i know the security concerns of having html embedded in sql entries but i can't see any other way of doing it. i'm not gonna break up article entries each time a person wants to bold some text. hopefully someone can help.

 

any solution whereby i can have parts of the text have different weights is useful. this forum can do it with those buttons up top but i can't figure it out. i'd love to set up a button like that actually.

Link to comment
https://forums.phpfreaks.com/topic/106396-solved-html-tags-in-a-longtext/
Share on other sites

god bless you norsk.firefox

 

works perfectly now. i can't believe no one could help me with that issue. now that i've looked up what the function does it completely makes sense. teach me for copy pasting from tutorials :)

 

thanks again, you've made my life much easier.

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.