Here's a question I've been wrestling wtih.

Suppose that there is an HTML form to create a new user. When the form
is submitted, that user's information is added to the 'user' table.
The table uses an auto-increment integer for its primary key/user id,
so I'd like to grab that value for the newly created user.

I've been using queries like this one: "SELECT MAX(user_id) FROM
users", but I worry that if two users are created at the same time,
then my query might give me the user id of the wrong user.

Is there a better way to do this? Or maybe I shouldn't even worry about this?

Thanks.
Chris

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234922
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to