public static function mquery($sql){
$conn = self::db_connect();
$rs=mysqli_query($conn,$sql);
mysqli_close($conn);
public static function insert($table,$data){
$conn=self::db_connect();
$fields = array();
$values = array();
foreach ($data as $key => $value) {
$value = str_replace("'", '&apos', $value);//单引号替换字符实体
$value = str_replace('"', '"', $value);//双引号替换
$fields[]= "`".$key."`";
$values[]="'".$value."'";
}
$fields = implode(',', $fields);
$values = implode(',',$values);
//sql 语句
$sql = "insert into {$table} ({$fields}) values ({$values})";
//dump($sql);exit();
$insert_id =0;
if (mysqli_query( $conn,$sql)){
$insert_id = mysqli_insert_id($conn);
}
mysqli_close($conn);
return $insert_id;
}
return $rs;
}
星火2018-10-14 07:42:07
If mysqli_query is replaced with self::mquery() mysqli_insert_id (what should be passed in here)