Mysql + php with special characters like '(Apostrophe) and " (Quotation mark)

后端 未结 7 551
礼貌的吻别
礼貌的吻别 2020-12-10 05:28

I have been struggling with a small problem for a while. It\'s been there for years but it\'s just been an irritating problem and not a serious one, and I have just worked a

相关标签:
7条回答
  • 2020-12-10 06:09

    you can use addslashes() function. It Quote string with slashes. so, it will be very useful to you when you are adding any apostrophe in your field.

    $result = mysql_query("INSERT INTO `table` (`row1`) VALUES ('".addslashes($_POST['text'])."') ") or die(mysql_error());
    
    0 讨论(0)
提交回复
热议问题