Link to home
Start Free TrialLog in
Avatar of QuintusSmit
QuintusSmit

asked on

Get id of newly created database entry

Hi

I am wrinting a registration system for my students in php. I have a form that gets submited with all the info but I want certain things to get registered in the background based on selections in the form. I cant always trust that student numbers will be unique so I want to retrieve the unique id no created for the person by the mysql db.

Logic says submit the user to the db and then immediatly query the id to a variable once created. My problem is what if there is a duplicate name or student number already. Should I
just check for that before submitting or is there a better way to do this.

Tx
Quintus
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of QuintusSmit
QuintusSmit

ASKER

Perfect! Thank you very much