如何插入"不要串入mysql表?

时间:2017-11-11 11:23:16

标签: php sql

我可以使用下面的don't查询将关键字SQL插入到我的表格中:

INSERT INTO feedback (user_id, user_type, problem, description, status,
posted_on) VALUES ('IN0018','MR','I don't have any prob','ha hah ha ha 
ha','1',NOW())

3 个答案:

答案 0 :(得分:1)

你需要逃避角色。您可以使用以下方式实现它:

INSERT INTO 
feedback (user_id, user_type, problem, description, status, posted_on)
 VALUES 
('IN0018','MR','I don''t have any prob','ha hah ha ha ha','1',NOW())
                     /
                    Here

使用两个单引号来逃避它。

答案 1 :(得分:1)

放另一个':'I don''t have any prob'

答案 2 :(得分:0)

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 OPTIONS http://localhost:90909/api/products/3434  
info: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
      Policy execution successful.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 15.8032ms 204 
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 PATCH http://localhost:90909/api/products/3434 application/json;charset=UTF-8 805
info: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
      Policy execution successful.
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed for user: (null).
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[3]
      Authorization failed for the request at filter 'Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter'.
info: Microsoft.AspNetCore.Mvc.ChallengeResult[1]
      Executing ChallengeResult with authentication schemes ().
info: Microsoft.AspNetCore.Builder.IdentityServerAuthenticationHandler[12]
      AuthenticationScheme: Bearer was challenged.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
      Executed action InventoryApi.Controllers.ProductsController.Update (InventoryApi) in 46.6963ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 127.3384ms 401 

尝试此解决方案。