bulk insert mysql code example
Example 1: mysql batch insert
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
Example 2: mysql best way to insert many rows
INSERT INTO table_name(id,colname) values(1,"row 1"),(2, "row 2"),...;
Example 3: php bulk insert mysql
$values = array();
foreach($data as $row ) {
$values[] = '('.$row['id'].', "'.mysql_real_escape_string($row['name']).'")';
}
mysql_query('INSERT INTO table (id, name) VALUES '.implode(',', $sql));