I am saying do both INSERTs in the same `batch()`, but your second INSERT should do a nested SELECT

I am saying do both INSERTs in the same batch(), but your second INSERT should do a nested SELECT to figure out the user ID that was added in the first insert.

Also, actually in your case above, just move the nanoid() into a local variable before you create your statements, and use that in both queries. Isn't that nanoid what you want in the second insert or is it an autoincrement key?
Was this page helpful?