function insert($table,$array){ //连接数据库 Global $con; $keys = join(",",array_keys($array)); $array = array_values($array); $vals = ""; foreach ($array as $key => $value) { if ($key==0) { $sep = ""; }else{ $sep = ","; } $vals.= $sep."'".$value."'"; } $sql = "INSERT INTO {$table} ($keys) VALUES ({$vals})"; mysqli_query($con,$sql); return mysqli_insert_id($con); mysqli_close($con); }
不告诉你
2014-10-19
2 回答
举报
0/150
提交
取消