5 seg question - last insert ID on update

Anyone knows if the PDO::lastInsertId() works with update queries?


AFAIK, Nope!

Returns the ID of the last inserted row, or the last value from a sequence object, depending on the underlying driver. For example, PDO_PGSQL() requires you to specify the name of a sequence object for the name parameter.

The function name itself says that it will return last INSERT id.

BTW, why do you need the ID to be returned from there since you will have to already use the ID to update a row in the query right?

Correct. :eye: All clear. Thanks again.

slaps Márcio :lol:

I do deserve it.

Let’s forget about it ok? :stuck_out_tongue: