function Multi_Insert($table, $value= array()) {
try {
if (!is_array($value)) {
$value = (array) $value;
}
$Col = array_keys($value[0]);
foreach ($value as $i => $Value) {
$Value = array_map(‘mysql_real_escape_string’, array_values($Value));
$Row[$i] = sprintf(“(‘%s’)”, join(“‘,'”, $Value));
}
$sql = sprintf(“INSERT INTO `%s` (`%s`) VALUES %s”, $table, join(“`,`”, $Col), join(“,”, $Row));
$insert = mysql_query($sql, “[MYSQL CONNECTION][mysql_connect($host, $user, $pass)]”);
} catch (exception $error) {
return mysql_error(“[MYSQL CONNECTION]”);
}
return $insert;
}