这合法吗?
$string1= "INSERT INTO....;";
$string1 .= "INSERT INTO....;";
$string1 .= "INSERT INTO....;";
mysql_query($string1) or die(mysql_error()); 发布于 2009-08-20 17:20:33
根据您是否将相同的数据插入到相同的表中,it's much better to insert multiple values with the one insert例如
INSERT INTO a VALUES (1,23),(2,34),(4,33);
INSERT INTO a VALUES (8,26),(6,29);发布于 2009-08-20 17:20:08
发布于 2013-10-24 22:49:23
来自MySQL开发支持MySQL dev forum
INSERT INTO table (artist, album, track, length)
VALUES
("$artist", "$album", "$track1", "$length1"),
("$artist", "$album", "$track2", "$length2"),
("$artist", "$album", "$track3", "$length3"),
("$artist", "$album", "$track4", "$length4"),
("$artist", "$album", "$track5", "$length5");所以insert一如既往地正常运行:
很高兴用一条insert语句插入多个值。:)
https://stackoverflow.com/questions/1307618
复制相似问题