Getting the row back from an insert query...?

Is there any way to get MySQL to retrieve a newly inserted row?

It seems my code is doing this sort of thing a lot:

insert into users_table(a, b, c, d) values (“a”, “b”, “c”, “d”);
var x = select from user_id from users_table where a=“a”;
update other_table set user_id = “x” where something

In other words, inserting a new row and then immediately having to retrieve the key for that row in order to link it in some other table.

if the table you are inserting into has an AUTO_INCREMENT column (you didn’t mention), then you can use the LAST_INSERT_ID function