php insert array into mysql code example
Example 1: how to bulk insert array into sql php
$sql = array();
foreach( $data as $row ) {
$sql[] = '("'.mysql_real_escape_string($row['text']).'", '.$row['category_id'].')';
}
mysql_query('INSERT INTO table (text, category) VALUES '.implode(',', $sql));
Example 2: php insert array into mysql table
$matstring=implode("','",$matrix[1]);
mysql_query('INSERT INTO Australia (Price, Company, Days, Weight) VALUES ('$matstring')');