I think I understand how PostgreSQL and RETURNING work — I found many, many resources. If I catch, it will look something like
"INSERT INTO table (column2, column3) VALUES ('value1', 'value2') RETURNING id;"
However, I cannot find anything to help me access this through PHP. When I thought I understood, I tried
$new_id = pg_query($dbc, "INSERT INTO table (column2, column3) ". "VALUES ('value1', 'value2') RETURNING id;"); return $new_id;
But it returns NULL. I also tried to execute and declare the variable separately with one request. After you found the clock to solve, I settled on the SELECT (id) SELECT statement / function, but that still bothers me. Any help is appreciated.
I am using Postgres 8.4 and PHP 5.3.
regan_leah
source share