Moje funkce pro toto:
function i($table, $array) {
$query = "INSERT INTO ".$table;
$fis = array();
$vas = array();
foreach($array as $field=>$val) {
$fis[] = "`$field`"; //you must verify keys of array outside of function;
//unknown keys will cause mysql errors;
//there is also sql injection risc;
$vas[] = "'".mysql_real_escape_string($val)."'";
}
$query .= " (".implode(", ", $fis).") VALUES (".implode(", ", $vas).")";
if (mysql_query($query))
return mysql_insert_id();
else return false;
}