Hello
I want to do that after submitting form it will insert in a table. the table has auto increment field. name of the field is ID. Now how can I get the ID number of that inserted data's ID number. for example

I have a table which field are as bele
1. user_ID as auto increment number
2. user_name as varchar
3. father_name as varchar

No I want that When I submit a form which has user name & father name text box. It will be inserted in the table. After inserting those data It will show me the ID of that user. remember user_name is not uniq. I know how to insert.

Just tell me how can I get the ID. Thank u

I've used this before. $id is the the value of the primary key of the row that you just inserted.

$link = mysql_connect(DB_HOST, USER, PASSWORD) or die(mysql_error());
mysql_select_db(DATBASENAME) or die(mysql_error());  

$query = "query here";
mysql_query($query)
$id = mysql_insert_id($link);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.