It’s taken me ages to find out how to do this (what turns out to be a) relatively simple operation.
Here’s the problem. Table 1 has a user_id which is auto incremented by MYSQL. Table 2 has an auto incremented login_id but also requires the user_id. Here’s how we get one ID from one table to the other:
Simple! We can then refer to the LastID in Table 2
About The Author
Katy is always trying to be more productive one day at a time! Whether it's analogue, digital, motivational or psychological who'll try any system that will help her get things done and get organised.
As well as running FlippingHeck.com, she also loves making music and reviewing things.
Follow Katy Whitton on:
Please Note: This website may contain affiliate links, including those from the Amazon Associates program. This means that if you click on certain links and make a purchase, we may receive a commission at no additional cost to you. As an Amazon Associate, we earn from qualifying purchases. Additionally, some of the content on this site may have been created in collaboration with our partners. These collaborations help support our site and allow us to continue providing valuable content to our readers. Rest assured, we are committed to maintaining the integrity and independence of our content. For more information, please read our full Advertising & Affiliate Disclosure Policy
I have been surfing for mire than three hours today, and i’m yet to find a page like yours. It has made my effort online worth while. In my view, if all site owners andd bloggers prodcuced good content like this, the webb would be a ore useful resource.
This website uses cookies to improve your experience, for basic analytics and to allow you to access our free downloads. By continuing to browse, you consent to our use of cookies. You can view our Privacy Policy and Cookie Policy to see how we use limited personal data.
“Could you not use MAX() to get the highest ID number?”
“Could do, but if someone else was updating the recordset at the same time apparently it could get a bit screwey, there’s several ways of doing it.”
I have been surfing for mire than three hours today, and
i’m yet to find a page like yours. It has made my effort online worth while.
In my view, if all site owners andd bloggers
prodcuced good content like this, the webb would
be a ore useful resource.