Detecting ID of just written DB entry !

J

Jake

I have a DB with 3 fields.
ID
Name
EMail

If I write an entry into this DB, Name and EMail, the ID is auto
increment.

How can I detect what ID has been created ?

I want a user to submit details to me, they get the ID as a ticket
number ?

How can I do this ?

Thanks
 
B

Bertrand

once the table has been updated, you can run a query with
with Max(ID ) to retrieve the highest (and therefor last)
ID entered in the ID ... because more than one user can
add themselves, there is a chance that the answer is
actually not correct ... so you need to first retrieve the
Max ID then check that the name + email match the ones for
that ID and if not then just do Max(ID) - 1 or -2 etc
until you find the right combination ...
or you could just run a query bla bla Where Name =
request.form("Name") AND Email = request.form("Email") ...
the odds of 2 users with same name + same email is very
slim of course ... so the second solution is proably
better ...

HTH,

Bertrand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top