Jump to content

Storing html code in a mysql field


Shadowing

Recommended Posts

Im having trouble figuring out how to update a field in mysql to everything that $message holds. So when I select it later and echo it it will display just as if I echo it with out putting it into mysql

 

$message = implode(", ",$b) . " from planet <a href='map.php?x=$attacker_x&y=$attacker_y&planet=
$attacker_address'>$attacker_planet</a> has joined your forces on planet " . $defender_planet_name . ".";

How do i set up a column to accept this.

 

I have my column set to

TEXT

with collation utf8_unicode_ci

 

Link to comment
Share on other sites

sorry thorpe i thought the code i posted was enough


$message = implode(", ",$b) . " from planet <a href='map.php?x=$attacker_x&y=$attacker_y
&planet=$attacker_address'>$attacker_planet</a>
has joined your forces on planet " . $defender_planet_name . ".";

$news1 = "INSERT INTO news SET time = '".($phptime)."', id = '".($_SESSION['user_id'])."', 
message = '".($message)."' , active = 0";		
$news = mysql_query($news1) or die(mysql_error());

 

just trying to insert into a column the variable $message holds . So when I select it later it returns with the html code. right now it just deny's the entry completely

Link to comment
Share on other sites

lol the brackets half way worked. It got rid of the syntax error and i was able to echo it with a clickable link accept it puts the brackets around the link

 

The return was with Zoaghea being a clickable link

 

50 Jaffa from planet {Zoaghea} has joined your forces on planet Nashira.

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.