📜  如何将数组批量插入 sql php 代码示例

📅  最后修改于: 2022-03-11 14:54:32.475000             🧑  作者: Mango

代码示例2
$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));