($vals)还是({$vals})?
function insert($table,$array) {
$keys = join(",", array_keys($array));
$vals = "'".join("','", array_values($array))."'";
$sql = "insert {$table}($keys) values({$vals})";
mysql_query($sql);
if($sql)
{
return mysql_insert_id();
}
else
{
echo mysql_error();
}
}
问一个问题,就是values({$vals})这里括号里能不能写成values($vals),即不用加花括号