insert multiple rows via a php array into mysql

后端 未结 12 1515
自闭症患者
自闭症患者 2020-11-21 22:35

I\'m passing a large dataset into a MySQL table via PHP using insert commands and I\'m wondering if its possible to insert approximately 1000 rows at a time via a query othe

12条回答
  •  情书的邮戳
    2020-11-21 23:29

    You could always use mysql's LOAD DATA:

    LOAD DATA LOCAL INFILE '/full/path/to/file/foo.csv' INTO TABLE `footable` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' 
    

    to do bulk inserts rather than using a bunch of INSERT statements.

提交回复
热议问题