I'm using php and postgres in a web system, I have a form that I'm saving by doing the insert using pg_query, however, I'd like to get the id of the new record after inserting, but I'm not getting it, or it returns null or false . What I've already tried:
$resultado = pg_query($sql);
var_dump(pg_last_oid(pg_affected_rows($resultado)));
$resultado = pg_query($sql);
var_dump(pg_last_oid($resultado));
$row = pg_fetch_row($resultado);
var_dump($row[0]);
$row = pg_fetch_array($resultado, null, PGSQL_ASSOC);
var_dump($row[0]);
Nothing worked, is there a way to do this?