Mysql语句中动态变量包含引号

来源:转载

 Francesca' S控股为变量值,中间含有单引号 。MQL把变量中的 '读取了没有当做纯文本

SELECTid AS id,brand_name AS brandName,keywords AS keywords,description AS descriptionFROMbrand AS BrandWHEREbrand_name LIKE '%Francesca' S控股 % ' ORDER BY id ASC

错误如下[SQL]SELECTid AS id,brand_name AS brandName,keywords AS keywords,description AS descriptionFROMbrand AS BrandWHEREbrand_name LIKE '%Francesca' S控股 % ' ORDER BY id ASC[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S控股 % ' ORDER BY id ASC' at line 9

更新后在引号前加入/,'变成了/' 不再报错,把整个参数当成了纯文本SELECTid AS id,brand_name AS brandName,keywords AS keywords,description AS descriptionFROMbrand AS BrandWHEREbrand_name LIKE '%Francesca/' S控股 % ' ORDER BY id ASC


分享给朋友:
您可能感兴趣的文章:
随机阅读: