MySQL Query not inserted when PHP variable contains single quotes

后端 未结 7 540
情书的邮戳
情书的邮戳 2021-01-17 05:49

This query not inserted when variable $subject has single quotes . Is there any possible solution available ?

mysql_query(\"INSERT INTO  table  (to_email_id,         


        
7条回答
  •  逝去的感伤
    2021-01-17 06:37

    if you are using

    (all book's are available) as $subject and you are trying to insert in to mysql

    use this

    $disc_str = addslashes($subject);
    

    "INSERT INTO table name (subject) value('$disc_str')";

    it works for me in Textarea with tinymce also

提交回复
热议问题