这个问题在这里已有答案:

如何在PHP中阻止SQL注入?                                     28个答案

我收到此错误:

您的SQL语法有错误; 检查与您的MySQL服务器版本相对应的手册,以便在's','portal','','offer','MSNBC','News','','sports',''附近使用正确的语法, 第3行的“MSN”,“金钱”,“游戏”

唯一的问题是插入包含撇号的数据时会出现此错误。 我尝试将数据类型从mysql_real_escape_string更改为TEXT,但结果仍然相同。

我试着把mysql_real_escape_string

如何解决这个问题?

编辑:

$query=" INSERT INTO alltags

(id,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10,tag11,tag12,tag13,tag14,tag15,tag16,tag17,tag18,tag19,tag20,tag21,tag22,tag23,tag24,tag25,tag26,tag27,tag28,tag29,tag30)

VALUES

('',mysql_real_escape_string($uniqkey[0]),mysql_real_escape_string($uniqkey[1]),mysql_real_escape_string($uniqkey[2]),mysql_real_escape_string($uniqkey[3]),mysql_real_escape_string($uniqkey[4]),mysql_real_escape_string($uniqkey[5]),mysql_real_escape_string($uniqkey[6]),mysql_real_escape_string($uniqkey[7]),mysql_real_escape_string($uniqkey[8]),mysql_real_escape_string($uniqkey[9]),mysql_real_escape_string($uniqkey[10]),mysql_real_escape_string($uniqkey[11]),mysql_real_escape_string($uniqkey[12]),mysql_real_escape_string($uniqkey[13]),mysql_real_escape_string($uniqkey[14]),mysql_real_escape_string($uniqkey[15]),mysql_real_escape_string($uniqkey[16]),mysql_real_escape_string($uniqkey[17]),mysql_real_escape_string($uniqkey[18]),mysql_real_escape_string($uniqkey[19]),mysql_real_escape_string($uniqkey[20]),mysql_real_escape_string($uniqkey[21]),mysql_real_escape_string($uniqkey[22]),mysql_real_escape_string($uniqkey[23]),mysql_real_escape_string($uniqkey[24]),mysql_real_escape_string($uniqkey[25]),mysql_real_escape_string($uniqkey[26]),mysql_real_escape_string($uniqkey[27]),mysql_real_escape_string($uniqkey[28]),mysql_real_escape_string($uniqkey[29])) ";

mysql_query($query) or die(mysql_error());

我将其更改为mysql_real_escape_string。这种语法是否正确? 我收到了错误。

mysql 怎么加上撇号_php - 如何在写入Mysql数据库时处理撇号相关推荐

  1. php 单引号 数据库,关于php:如何在写入Mysql数据库时处理撇号’单引号

    本问题已经有最佳答案,请猛点这里访问. 我得到这个错误: You have an error in your SQL syntax; check the manual that corresponds ...

  2. Python将数据插入到数据库时遇到单引号插入错误的问题

    这才是真正的解决方法,真不知道有些人连试都没试过就乱转载 比如你要插入一个字符串,是一个变量 如:str = "I'am a handsom boy" 由于这个字符串包含',插入数 ...

  3. OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(三)Kepserver 数据写入mysql数据库

    在上篇教程:OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(一)中我们学习了MySQL数据库简介.OPC服务器软件Kepserver软件介绍.MySQL5.5数据库安 ...

  4. kepserver写入mysql_OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(三)Kepserver 数据写入mysql数据库...

    在上篇教程:OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(一)中我们学习了MySQL数据库简介.OPC服务器软件Kepserver软件介绍.MySQL5.5数据库安 ...

  5. linux带行号显示数据,linux中查看文件时显示行号

     [root@1-min etc]# cat -n rsyslog.conf//显示所有行号(包括空行) [root@1-min etc]# cat -b rsyslog.conf         ...

  6. php mysql中文乱码怎么解决_php读取mysql中文乱码怎么解决?

    解决方法:1.在网页文件中使用设置UTF-8编码:2.新建数据库时设置UTF-8编码:3.PHP连接数据库时,使用"mysql_query("set names 'utf8'&qu ...

  7. flink sink jdbc没有数据_No.2 为什么Flink无法实时写入MySQL?

    抛出疑无路? [Flink 1.10]- 使用flink-jdbc连接器的方式与MySQL交互,读数据和写数据都能完成,但是在写数据时,发现Flink程序执行完毕之后,才能在MySQL中查询到插入的数 ...

  8. php 写入mysql 乱码,php写入mysql中文乱码的实例解决方法

    php写入mysql中文乱码的实例解决方法 php写入mysql出现中文乱码的解决办法是:在建立数据库连接之后,将该连接的编码方式改为中文. 代码如下: $linkID=@mysql_connect( ...

  9. python向mysql中添加数据标签_用python在MySQL中写入数据和添加数据

    在笔者之前的博文中,已介绍了用python连接与mysql数据库的知识.包括如何安装python连接mysql的pymysql包,如何通过cusor语句将python与mysql连接起来,以及如何用p ...

最新文章

  1. Swagger 入门使用
  2. python使用shell环境变量_linux中添加环境变量(python为例)
  3. Apache Apollo REST API
  4. 【Tensorflow】小白入门实战基础篇(下)
  5. Core Graphics 定制UIVIew 处理图片
  6. 疾速激爽,电竞玩家的心仪之选:AMD 锐龙 5000 系列登场!
  7. opencv3+python3.5成语填字游戏(一)印刷体汉字的分割
  8. 如何在通达信软件上随意画图_通达信指标公式编写教程:绘图函数DRAWLINE、DRAWTEXT 等...
  9. 自动化和半自动矢量化提取地物矢量轮廓
  10. MICRO USB引脚定义以及接法
  11. qq邮箱foxmail imap服务器,foxmail登录imap服务器提示失败。怎么办?
  12. SAP SD 销售订单收入和成本对应科目的逻辑
  13. 基本农田卫星地图查询_天地图山东,购房者勘测利器,国产骄傲
  14. 集算器替代存储过程实现报表数据源
  15. 想要彻底卸载Mac应用程序,还得要用这些方法才行
  16. 通信技术——水下通信技术的分类、特征、应用及其最新研究进展
  17. 1. 对输入的数组正序输出
  18. 关于DES加密强制更新版(4.22)
  19. 戏说:诸葛亮的真实身份竟是汉献帝
  20. Markdown 更改字体颜色

热门文章

  1. csv文件中文乱码转换
  2. 8.14. JSON Types
  3. 假设今天你开了一家经营生鲜品类的淘宝店,你怎么获取第一批用户, 并能够运营起来
  4. 如何提高Windows 系统性能
  5. //利用 DirectoryInfo递归遍历文件夹,删除所有文件,文件夹
  6. 前端H5各种qq,微博,fb,whatsapp等网页分享的链接
  7. Learun FrameWork,基于.NET的智能化开发工具
  8. 网站流量数据分析技巧【转】
  9. 02 LED的闪烁、模拟交通灯
  10. Mac中删除docker镜像