in reply to Re: last_insert_id did not work
in thread last_insert_id did not work

Doing it that way, would I have to tell it which table? or does it already know?

Example:
$_chinsert = $dbh->selectrow_array("SELECT LAST_INSERT_ID()");
that does not specify which table, if the site is busy, could that not get something else from someone else?

Thanks,
-Richard

Replies are listed 'Best First'.
Re^3: last_insert_id did not work
by Bod (Parson) on Mar 27, 2021 at 23:23 UTC
    Doing it that way, would I have to tell it which table? or does it already know?

    No need to specify the table. LAST_INSERT_ID() returns the ID of the last insert made on a table with an auto-increment column by the session calling the function.

    could that not get something else from someone else?

    No because the function only returns the information from the current session.

      I understand, thank you much!

      Thanks again.