How do I handle single quotes inside a SQL query in PHP?

前端 未结 3 1223
陌清茗
陌清茗 2020-12-12 08:10

I am using a particular query for inserting records. It is going well. I am even fetching records with a select query. But my problem is that, if the record contains single

3条回答
  •  悲&欢浪女
    2020-12-12 08:55

    use http://www.php.net/manual/en/function.mysql-real-escape-string.php function on your string to quote "'" and other special symbols Other way to prevent injection - use different connections (login-passwords) with different rights for inserting and selecting. In this case mysql_real_escape_string wi9ll work good

提交回复
热议问题