mysql 批量操作插入或更新(类似sqlite的事务)

insert into UserNotes(id,bookId,user,deviceId ,word,keywd,exp,createTime,lastEditTime) values ('','$notebookname','$name','000000','$word','$keyArr[$i]','$explainArr[$i]',$curTime,$curTime),
('','$notebookname','$name','000000','$word','$keyArr[$i]','$explainArr[$i]',$curTime,$curTime),
('','$notebookname','$name','000000','$word','$keyArr[$i]','$explainArr[$i]',$curTime,$curTime)
ON DUPLICATE KEY UPDATE user=VALUES(user),word=VALUES(word);
如果是整数 id=VALUES(id)

发表新评论