I have a problem with the "pg_getlastoid()" function in php. I will
illustrate it with a example:
Create a table with psql:
create table test_serial ( id serial, name varchar );
Insert a record into the tabel with php:
$db = pg_pconnect ("host=10.0.0.2 port=5432 dbname=sockaart
user=postgres password=postgres");
if (!$db)
{
fatal_error("no connection.");
}
$result = pg_Exec ($db, "insert into test_serial (naam) values
'twan')");
if (!$result)
{
fatal_error("no insert: ".pg_errormessage ($db));
}
print pg_getlastoid($result)."<br>";
The line "print pg_getlastoid($result)."<br>";" should print the
number of the last inserted id, but it doesn't.
It prints the following number 33589 which increases every time when
you reload the page with 1.
What is going on here?
Best regards,
- Twan