mysql-5.6.17 insert values中含css代码 报语法错

目标库mysql版本:5.6.17

修改前:

INSERT INTO `test_company` (
	`url`,
	`dir`,
	`title`,
	`a`,
	`b`,
	`style`,
	`js`,
	`c`,
	`who`,
	`op_time`,
	`ver`
)
VALUES
	(
		'test/company/edit',
		'test/company',
		'测试',
		NULL,
		NULL,
		'#edit{\n        display: none;/*隐藏框*/\n        width: 100%;\n        height: 100%;\n        position: fixed;/*固定定位*/\n        overflow: auto;/*不滚动*/\n        background-color: rgba(0,0,0,0.7);\n        top: 0px;\n        left: 0px;\n        z-index: 9999;/*图层浮在最上*/\n    }\n    .close{\n        font-size: 40px;\n        font-weight: bold;\n        position: absolute;\n        top: 110px;\n        right:30px;\n        color:#CAE1FF;\n    }\n    .close:hover,\n    .close:focus{\n        color:red;\n        cursor:pointer;\n    }\n    #img{\n        display: block;/*以块展示*/\n        margin:0px auto;/*居中对齐*/\n        margin-top:150px;\n        width: 90%;\n        max-width: 1600px;/*宽度自适应*/\n    }\n    \n}',
		'$(\"#addr\").attr(\'placeholder\',\'请填写详细地址\');\nvar id =  getParam(\'id\');\nvar userno =  getParam(\'userno\');\n}',
		'0',
		'',
		NULL,
		'4'
	);

insert会报syntax error[Err] 1064 - Erreur de syntaxe près de ''#edit{\n display: none;/*隐藏框*/\n width: 100%' à la ligne 21
用数据库V5.1.73-log测试也报syntax error。把style的值(\n已解析)从表里 copy出来,粘贴保存ok。
最后发现在注释和代码之间'display: none;/*隐藏框*/',中间加上空格:'display: none; /*隐藏框*/',insert就成功了。其实也没有整行都加一遍,不知什么原理。

修改后:

INSERT INTO `test_company` (
	`url`,
	`dir`,
	`title`,
	`a`,
	`b`,
	`style`,
	`js`,
	`c`,
	`who`,
	`op_time`,
	`ver`
)
VALUES
	(
		'test/company/edit',
		'test/company',
		'测试',
		NULL,
		NULL,
		'#edit{\n        display: none; /*隐藏框*/\n        width: 100%;\n        height: 100%;\n        position: fixed; /*固定定位*/\n        overflow: auto; /*不滚动*/\n        background-color: rgba(0,0,0,0.7);\n        top: 0px;\n        left: 0px;\n        z-index: 9999; /*图层浮在最上*/\n    }\n    .close{\n        font-size: 40px;\n        font-weight: bold;\n        position: absolute;\n        top: 110px;\n        right:30px;\n        color:#CAE1FF;\n    }\n    .close:hover,\n    .close:focus{\n        color:red;\n        cursor:pointer;\n    }\n    #img{\n        display: block; /*以块展示*/\n        margin:0px auto; /*居中对齐*/\n        margin-top:150px;\n        width: 90%;\n        max-width: 1600px;/*宽度自适应*/\n    }\n',
		'$(\"#addr\").attr(\'placeholder\',\'请填写详细地址\');\nvar id =  getParam(\'id\');\nvar userno =  getParam(\'userno\');\n}',
		'0',
		'',
		NULL,
		'4'
	);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值