mysql 怎么加上撇号_php - 如何在写入Mysql数据库时处理撇号
这个问题在这里已有答案:
如何在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数据库时处理撇号相关推荐
- php 单引号 数据库,关于php:如何在写入Mysql数据库时处理撇号’单引号
本问题已经有最佳答案,请猛点这里访问. 我得到这个错误: You have an error in your SQL syntax; check the manual that corresponds ...
- Python将数据插入到数据库时遇到单引号插入错误的问题
这才是真正的解决方法,真不知道有些人连试都没试过就乱转载 比如你要插入一个字符串,是一个变量 如:str = "I'am a handsom boy" 由于这个字符串包含',插入数 ...
- OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(三)Kepserver 数据写入mysql数据库
在上篇教程:OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(一)中我们学习了MySQL数据库简介.OPC服务器软件Kepserver软件介绍.MySQL5.5数据库安 ...
- kepserver写入mysql_OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(三)Kepserver 数据写入mysql数据库...
在上篇教程:OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(一)中我们学习了MySQL数据库简介.OPC服务器软件Kepserver软件介绍.MySQL5.5数据库安 ...
- linux带行号显示数据,linux中查看文件时显示行号
[root@1-min etc]# cat -n rsyslog.conf//显示所有行号(包括空行) [root@1-min etc]# cat -b rsyslog.conf ...
- php mysql中文乱码怎么解决_php读取mysql中文乱码怎么解决?
解决方法:1.在网页文件中使用设置UTF-8编码:2.新建数据库时设置UTF-8编码:3.PHP连接数据库时,使用"mysql_query("set names 'utf8'&qu ...
- flink sink jdbc没有数据_No.2 为什么Flink无法实时写入MySQL?
抛出疑无路? [Flink 1.10]- 使用flink-jdbc连接器的方式与MySQL交互,读数据和写数据都能完成,但是在写数据时,发现Flink程序执行完毕之后,才能在MySQL中查询到插入的数 ...
- php 写入mysql 乱码,php写入mysql中文乱码的实例解决方法
php写入mysql中文乱码的实例解决方法 php写入mysql出现中文乱码的解决办法是:在建立数据库连接之后,将该连接的编码方式改为中文. 代码如下: $linkID=@mysql_connect( ...
- python向mysql中添加数据标签_用python在MySQL中写入数据和添加数据
在笔者之前的博文中,已介绍了用python连接与mysql数据库的知识.包括如何安装python连接mysql的pymysql包,如何通过cusor语句将python与mysql连接起来,以及如何用p ...
最新文章
- Swagger 入门使用
- python使用shell环境变量_linux中添加环境变量(python为例)
- Apache Apollo REST API
- 【Tensorflow】小白入门实战基础篇(下)
- Core Graphics 定制UIVIew 处理图片
- 疾速激爽,电竞玩家的心仪之选:AMD 锐龙 5000 系列登场!
- opencv3+python3.5成语填字游戏(一)印刷体汉字的分割
- 如何在通达信软件上随意画图_通达信指标公式编写教程:绘图函数DRAWLINE、DRAWTEXT 等...
- 自动化和半自动矢量化提取地物矢量轮廓
- MICRO USB引脚定义以及接法
- qq邮箱foxmail imap服务器,foxmail登录imap服务器提示失败。怎么办?
- SAP SD 销售订单收入和成本对应科目的逻辑
- 基本农田卫星地图查询_天地图山东,购房者勘测利器,国产骄傲
- 集算器替代存储过程实现报表数据源
- 想要彻底卸载Mac应用程序,还得要用这些方法才行
- 通信技术——水下通信技术的分类、特征、应用及其最新研究进展
- 1. 对输入的数组正序输出
- 关于DES加密强制更新版(4.22)
- 戏说:诸葛亮的真实身份竟是汉献帝
- Markdown 更改字体颜色