I'm looking to be able to retrieve the last inserted id based on username. I know within PDO I am able to use to use lastInsertId() but from what I can tell that only gets the last one inserted with no other parameters. Is this possible in a short and simple?
The only way I thought I could do this was using something like
SELECT id FROM table_name WHERE username=:username ORDER BY enteredTimenDate ASC
Would this be the easiest way I could do this?
EDIT to address duplicate issue. The "Original" question this question is considered a duplicate of just asks how to retrieve the last inserted ID, my question was retrieving the last inserted ID based on another parameter.