如何在按钮单击时获取最后插入的ID,并应以html格式显示

Need to get the last inserted id from database on button click...after the button click there will be a new page ...on this page i want to print last inserted+1 means next id...please help me.

<a href="index.php"><button type="button" class="btn btn-warning">ADD MEMBER</button></a>

</div>

Hi its simple mysqli has its built in function for this

after successfull insertion just call this function

if (mysqli_query($conn, $sql)) {
    $last_id = mysqli_insert_id($conn);

}

or As mentioned in comments you can also run query to get last inseted id

if (mysqli_query($conn, $sql)) {  

  $result= mysqli_query($con ,"SELECT id FROM Table_name ORDER BY id DESC LIMIT 1 ");
$row = mysqli_fetch_assoc($result);
$last_id = $row['id'];

    }

$result= mysqli_query("SELECT * from tablename where id='".mysqli_insert_id($conn)."'");

Reference link: http://php.net/manual/en/mysqli.insert-id.php