1 function gen_this_insert_id($insert) 2 { 3 GLOBAL $link; 4 $insert .= ' SELECT LAST_INSERT_ID();'; 5 if (mysqli_multi_query($link, $insert)) { 6 if (mysqli_next_result($link)) { 7 if ($result = mysqli_store_result($link)) { 8 $w = mysqli_fetch_row($result); 9 RETURN $w[0]; 10 } 11 } 12 } 13 }
https://my.oschina.net/fz04003/blog/63327