如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变量最后再加一个';'错误提示依旧
最佳答案