用TP5批量更新数据出错,但sql语句直接执行没有负荆请罪错误

浏览:1669 发布日期:2017/04/21 分类:求助交流
用TP5批量更新数据出错,但sql语句直接执行没有负荆请罪错误

如sql语句数组:
$arr = array(
update tablename set name='test1',pass='123456' where id =1,
update tablename set name='test2',pass='123456' where id =2,
update tablename set name='test3',pass='123456' where id =3,
update tablename set name='test4',pass='123456' where id =4
);
以上语句直接执行没问题,implode函数用";"拼接后,在TP5内执行提示sql语法错误
$sql = implode(';',$arr);
Db:query($sql);

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;

在$sql变量最后再加一个';'错误提示依旧
最佳答案
评论( 相关
后面还有条评论,点击查看>>