OK, please don't call me stupid

Remember, I'm learning
I'm inserting this data into a database
name, number, time, trip, confirm (auto increment)
Question: I want to pull the confirm number DIRECTLY after I store it in the database. is there any way to do this without running another query?
I ask this, because if I say select confirm from sunday where name=joe and number=2225556358, and joe has more than one entry, and then I display it, it displays joe's first order. I don't care what joe ordered before, I just want to print his confirm number right after he orders.
Anybody understand my rambling just now?
Kevin