mysql query trouble

Discussion in 'Programming' started by izlik, Aug 13, 2010.

  1. #1
    Im ahving a problem inserting this into my database, why? the error occours from the <> tags etc and the collumn it's trying to be inserted in is "longtext" fields, why wont it work? :/

    INSERT INTO `qdbs_quotes` (`id`, `quote`, `rating`) VALUES
    (6, '<b>Assassin's Creed</b><br />\r\nAltair: &quot;"You cannot run forever!"&quot;', 0);
     
    izlik, Aug 13, 2010 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think you need to escape the special characters in the string. I'm not sure what function to use but mysql_real_escape_string() might be it.
     
    Cash Nebula, Aug 14, 2010 IP
  3. georgiivanov

    georgiivanov Member

    Messages:
    62
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    25
    #3
    As Cash Nebula said, use mysql_real_escape_string() or at least addslashes().

    You problem comes from Assassin's. It should be Assassin\'s ...
     
    georgiivanov, Aug 16, 2010 IP