How to get id of recently submitted record?

Hi all!
With due respect to rajug and webgypsy, I found this code in Sitepoint itself.:slight_smile:
This code generates member numbers;

$query=mysql_query("SELECT stud_master_initial, stud_master_cource, stud_master_batch, stud_master_id  FROM student_master WHERE stud_master_id=$id ");
$stud_id = $row['stud_master_id'];
$no= strtoupper($ini) . '-' . ($cource) . '-' .($batch) . '-' .$stud_id;
echo $no;

I wanted to display this Member Number after submission of the registration form.Something like, “Registered successfully, your member no is ???”.
But how can I fetch the data which I have submitted recently?
I dont know how to run a query like:
“SELECT * FROM student_master WHERE stud_master_id=$id”
What can be $id if I have just submitted the form??


Yeh its working.Thx.