[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] New user Account
****** message to minivend-users from cfm@maine.com ******
On Mon, May 22, 2000 at 05:07:56AM -0400, Victor Nolton wrote:
> ****** message to minivend-users from Victor Nolton <venom@inna.net> ******
>
>
> A client wants each new customer to be assigned a unique id number. this
> number would be the number for the 'code' field of the database.
> I need to figure out a way to read the database and find the last
> number in the database and of course add one to it. Just concerned about
> duplicate numbers. Of course the user will NOT know this number, but they
> still want the user to enter a username/id, and of course be able to call
> up the account information based on that name and of course a password.
>
> It is my understanding they want a database of people with numbers/codes
> like 168011 168012 168013...
>
> Has anyone done this before or am I totally wording this in a way noone
> can understand.
Yes, it makes sense. In our case we use cookie, email address and password -
sometimes another account number too - to tag a user. Since those can
change and there is not always a 1 to 1 we decided to create an internal
id. Something like:
INSERT <new id,x,y,z) INTO ids;
LOCK TABLE ids
$id=SELECT MAX(id)+1 FROM ids;
UPDATE ids SET id=$id;
UNLOCK
It was a good amount of work building it so it amounted to a single
transaction. If the id UPDATE fails you really don't want the user
logged in, etc...
--
Christopher F. Miller, Publisher cfm@maine.com
MaineStreet Communications, Inc 208 Portland Road, Gray, ME 04039
1.207.657.5078 http://www.maine.com/
Database publishing, e-commerce, office/internet integration, Debian linux.
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list