Hi
I have a table with the structure:
pin_id (PRIMARY) -> auto_increment
user_id (UNIQUE KEY) -> varchar16
email (UNIQUE KEY) -> varchar100
Normally, a person registers at my site and supplies the user_id and email which goes into the database, and a pin_id is automatically generated.
However, I have a need to only ask for the email address of a new member and not the user_id, so I would only be inserting the email address into the database. The pin_id is auto_increment.
The problem is that user_id is UNIQUE KEY and has to stay that way. Is there a way for me to somehow insert the pin_id into the user_id field DURING the FIRST database call?
For example, it would NOT work if I use last_insert_id since the first database call would have returned an error with duplicate empty string user_id fields ("" and "").
Or is there a better way to approach the problem?
Thanks!
Tennisguy
I have a table with the structure:
pin_id (PRIMARY) -> auto_increment
user_id (UNIQUE KEY) -> varchar16
email (UNIQUE KEY) -> varchar100
Normally, a person registers at my site and supplies the user_id and email which goes into the database, and a pin_id is automatically generated.
However, I have a need to only ask for the email address of a new member and not the user_id, so I would only be inserting the email address into the database. The pin_id is auto_increment.
The problem is that user_id is UNIQUE KEY and has to stay that way. Is there a way for me to somehow insert the pin_id into the user_id field DURING the FIRST database call?
For example, it would NOT work if I use last_insert_id since the first database call would have returned an error with duplicate empty string user_id fields ("" and "").
Or is there a better way to approach the problem?
Thanks!
Tennisguy