Shadowing Posted January 28, 2012 Share Posted January 28, 2012 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 Quote Link to comment Share on other sites More sharing options...
trq Posted January 28, 2012 Share Posted January 28, 2012 What? Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 28, 2012 Author Share Posted January 28, 2012 thanks for the reply thorpe currently the column isnt accepting the html link. Quote Link to comment Share on other sites More sharing options...
trq Posted January 28, 2012 Share Posted January 28, 2012 Why don't you post some relevant code then? Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 28, 2012 Author Share Posted January 28, 2012 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 Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 28, 2012 Author Share Posted January 28, 2012 ehh i just realized im getting a mysql error for syntax at the html <a> tag. I didnt realize this has to meet a certain syntax. no idea how to fix this Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 28, 2012 Author Share Posted January 28, 2012 well i added brackets around the <a> maybe it will work now. going to do a test. 50 Jaffa from planet {<a href=map.php?x=1&y=2&planet=226>Zoaghea</a>} has joined your forces on planet Nashira. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 28, 2012 Author Share Posted January 28, 2012 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. Quote Link to comment Share on other sites More sharing options...
trq Posted January 28, 2012 Share Posted January 28, 2012 Your going to need to escape $message. See mysql_real_escape_string Quote Link to comment Share on other sites More sharing options...
Shadowing Posted January 28, 2012 Author Share Posted January 28, 2012 ah thanks alot thorpe. much appreciated. was exactly what i was looking for. and its a good time for me to read more about mysql_real_escape_string() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.