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

Link to comment
Share on other sites

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.