Getting the ID which is primary key and AUTO_INCREMENT

$innsert_myTable = $dbc-> query("INSERT INTO myTable (myNumeric)
VALUES ($myNumeric)");

After inserting a record into myTable, I like to get the id of the record.
The id is primary key and AUTO_INCREMENT.

I try to use the code below for it.

$newID=$dbc->insert_id;

However, I got the notice below.

How can I correctly get the newly inserted id ?

https://www.php.net/manual/en/pdo.lastinsertid.php

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.