I am trying to add a record and at the same time return the identifier of this record. I read that this can be done with a sentence RETURNING.
$stmt->prepare("INSERT INTO tablename (field1, field2)
VALUES (:value1, :value2)
RETURNING id");
but the insertion fails when I add RETURNING. A field auto-incrementedcalled is added to the table id.
Can someone see something wrong with my syntax? or PDO does not support RETURNING?
source
share