Mark,

>
> I'm stuck on the code to do the insert.
>
> Here is the table structure:
>
> tblOne
> UserID Username
>
> tblTwo
> UserID Path

Your select looks fine.  To do the insert you have to do each table in
turn.  Insert your user into tblOne first and get the UserID that is
assigned to that new user (I'm assuming that you're using some form of
auto-increment field for UserID) and then insert the path using the
UserID that you got from tblOne.

To get the UserID for the new record you have to do either a select
Max(UserID) as NewUserID from tblOne or a select that you know will
return the record that you just inserted, eg. a creation date/time and
some of the user details.  The other alternative is to not use an
auto-increment field for your UserID and generate your user id, so that
you know what it will be before doing either insert.

Hope that helps

Regards

Stephen
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to