请问MYSQL怎么才能一次执行多条修改的sql语句? - 技术问答

如题,先谢谢各位了,小弟是个菜鸟。
2024-11-29 22:51:34
推荐回答(1个)
回答1:

[php]/* disable autocommit */$mysqli->autocommit(FALSE);$mysqli->query(\"CREATE TABLE myCity LIKE City\");$mysqli->query(\"ALTER TABLE myCity Type=InnoDB\");$mysqli->query(\"INSERT INTO myCity SELECT * FROM City LIMIT 50\");/* commit insert */$mysqli->commit();[/php]注意出错后要用$mysqli->rollback();回滚 查看更多答案>>