I am teaching myself about web programming. I am trying to create a user account for a website. I have two databases – first one (db_users – userid (auto increment), username, password) to store user information like the username, password, etc. and second one (db_address – userid (auto increment), address1, address2, city) to store the user’s address.
Now when I register a user, how do I ensure that both the tables are updated with the correct user id? Or is that not how a relational database works?
Without going into code you want to do:
$id = mysql_insert_id()$idEDIT: If using more than one MySQL connection you need to do
$id = mysql_insert_id($connection)