0

I have four fields in table id, name, city & state. I am inserting name , city & state. and id is auto increament

$mysql_register_resultset= mysqli_query($con, "INSERT into vendor (username, city, state) VALUES( '$name','$city','$state')");

It is successfully sumitted. I want that id value on next line of insertion. and i will process with that id.

How to get current id after insertion.

Mohaideen
  • 303
  • 1
  • 5
  • 17
  • possible duplicate of [php/MySQL insert row then get 'id'](http://stackoverflow.com/questions/897356/php-mysql-insert-row-then-get-id) – Amal Murali Mar 22 '14 at 04:27

1 Answers1

0

use this

$last_inserted_id =  mysqli_insert_id($con) ;
Ananth
  • 1,520
  • 3
  • 15
  • 28